vars_prompt within a role

323 views
Skip to first unread message

Nicholas Britton

unread,
May 9, 2019, 2:01:58 PM5/9/19
to Ansible Project
I am working on a project that will be mostly api based running locally and attaching to different environments via the api (uri module)

My plan was to create a role for each type of call that will be made, that way playbooks can be created to use any series of roles.   The problem i am running into is that i need to have the user provide data. For the few that will be ran non-interactivly i see the -e option overrides the same var that is prompted for, so that works when we need to run a playbook in that context.

From what i can tell it may not be possible to put  vars_prompt into the role and have that work.    Has anyone found a way to get this to work.


The biggest part of it is prompting for the servername that is part of the uri url.   I would like to not include this on every playbook , but as part of the login role that is always going to run.   That role is also asking for a user login and password.    That way we can keep application auditing intact , rather than using a service account.  





Brian Coca

unread,
May 9, 2019, 3:42:15 PM5/9/19
to Ansible Project
vars_prompt is only available at play, you can however use `pause` and
register user input.


--
----------
Brian Coca

Nicholas Britton

unread,
May 9, 2019, 4:07:39 PM5/9/19
to Ansible Project
Is that pause option available within a role?   Do you have some examples of that you would be willing to share?

Matt Martz

unread,
May 9, 2019, 4:10:31 PM5/9/19
to ansible...@googlegroups.com
The pause module documentation has examples for use

Since it is a module, a role can execute it:


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/384c438c-a29d-40e3-be4a-2ef47c66e553%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages