# Can I pass prompt variable to all of included playbooks?

**URL:** <https://forum.ansible.com/t/can-i-pass-prompt-variable-to-all-of-included-playbooks/12574>\
**Category:** Ansible Project\
**Created:** [March 25, 2013, 12:27pm UTC](https://forum.ansible.com/t/can-i-pass-prompt-variable-to-all-of-included-playbooks/12574 "2013-03-25T12:27:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [March 25, 2013, 12:27pm UTC](https://forum.ansible.com/t/can-i-pass-prompt-variable-to-all-of-included-playbooks/12574/1 "2013-03-25T12:27:00Z")

</div>

My case is:

1. I have a main.yml which includes A.yml and B.yml.
2. A.yml and B.yml have different hosts.
3. I have a password which is used in A.yml and B.yml.

I want to use vars\_prompt to set password and my expectation is only to prompt once to input password. But I didn’t find out the solution.  
If I set vars\_prompt in mainl.yml, A.yml and B.yml cannot get the variable.  
It seems that I must set vars\_prompt in both A.yml and B.yml. It means I have to input the same password twice.

Anybody knows how to implement my case with prompt once? Thank you!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 25, 2013, 12:57pm UTC](https://forum.ansible.com/t/can-i-pass-prompt-variable-to-all-of-included-playbooks/12574/2 "2013-03-25T12:57:45Z")

</div>

We would have to make some changes to make vars\_prompt global.

Generally I'm \*not\* a fan of vars\_prompt because it's interactive.  
A better option is "--extra-vars", which sets global variables for all  
playbooks.

You could also use a wrapper script, or read environment variables to  
achieve similar ends.

---

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [March 25, 2013, 3:40pm UTC](https://forum.ansible.com/t/can-i-pass-prompt-variable-to-all-of-included-playbooks/12574/3 "2013-03-25T15:40:34Z")

</div>

Thank you.
