# vars\_prompt within a role

**URL:** <https://forum.ansible.com/t/vars-prompt-within-a-role/30295>\
**Category:** Ansible Project\
**Created:** [May 9, 2019, 6:01pm UTC](https://forum.ansible.com/t/vars-prompt-within-a-role/30295 "2019-05-09T18:01:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Britton](https://avatars.discourse-cdn.com/v4/letter/n/a587f6/32.png) [@Nicholas\_Britton](https://forum.ansible.com/u/Nicholas_Britton)\
**Post date:** [May 9, 2019, 6:01pm UTC](https://forum.ansible.com/t/vars-prompt-within-a-role/30295/1 "2019-05-09T18:01:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 9, 2019, 7:41pm UTC](https://forum.ansible.com/t/vars-prompt-within-a-role/30295/2 "2019-05-09T19:41:54Z")

</div>

vars\_prompt is only available at play, you can however use `pause` and  
register user input.

---

<div class="post-metadata">

**Author:** ![Nicholas\_Britton](https://avatars.discourse-cdn.com/v4/letter/n/a587f6/32.png) [@Nicholas\_Britton](https://forum.ansible.com/u/Nicholas_Britton)\
**Post date:** [May 9, 2019, 8:07pm UTC](https://forum.ansible.com/t/vars-prompt-within-a-role/30295/3 "2019-05-09T20:07:39Z")

</div>

Is that pause option available within a role? Do you have some examples of that you would be willing to share?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 9, 2019, 8:09pm UTC](https://forum.ansible.com/t/vars-prompt-within-a-role/30295/4 "2019-05-09T20:09:39Z")

</div>

The pause module documentation has examples for use

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

[https://docs.ansible.com/ansible/latest/modules/pause\_module.html](https://docs.ansible.com/ansible/latest/modules/pause_module.html)
