# Does Ansible expose \`ansible\_become\_pass\` to modules?

**URL:** <https://forum.ansible.com/t/does-ansible-expose-ansible-become-pass-to-modules/28715>\
**Category:** Ansible Developer\
**Created:** [October 4, 2018, 6:52am UTC](https://forum.ansible.com/t/does-ansible-expose-ansible-become-pass-to-modules/28715 "2018-10-04T06:52:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_J](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@Dan\_J](https://forum.ansible.com/u/Dan_J)\
**Post date:** [October 4, 2018, 6:52am UTC](https://forum.ansible.com/t/does-ansible-expose-ansible-become-pass-to-modules/28715/1 "2018-10-04T06:52:26Z")

</div>

I’m trying to fix #29403 ([https://github.com/ansible/ansible/issues/29403](https://github.com/ansible/ansible/issues/29403)). In summary, when installing certain casks, Homebrew prompts for a password, which is undesirable. There is a workaround using a file given to SUDO\_ASKPASS, but in order for that to work, I would need to populate a named tempfile with ansible\_become\_pass. Is this variable exposed to modules? If so, how do I access it?

Thanks!

---

<div class="post-metadata">

**Author:** ![Andrew\_Latham](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Andrew\_Latham](https://forum.ansible.com/u/Andrew_Latham)\
**Post date:** [October 4, 2018, 1:39pm UTC](https://forum.ansible.com/t/does-ansible-expose-ansible-become-pass-to-modules/28715/2 "2018-10-04T13:39:30Z")

</div>

I may miss understand your question but when I use “”" ansible-playbook --vault-id ~/.ansible\_vault -e @…/vault.yml -i …/inventory.yml …/playbook.yml “”" I get all of my secured vault passwords usable in my roles/tasks so I could use something like expect to access those passwords when interacting with an installer.

Not a Apple user so shooting from the hip.

---

<div class="post-metadata">

**Author:** ![Dan\_J](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@Dan\_J](https://forum.ansible.com/u/Dan_J)\
**Post date:** [October 4, 2018, 6:54pm UTC](https://forum.ansible.com/t/does-ansible-expose-ansible-become-pass-to-modules/28715/3 "2018-10-04T18:54:53Z")

</div>

Hi Andrew,

Thanks for the reply. I’m actually looking to access ansible\_become\_pass within my module (as in, the Python code that runs when executing the task), so I’m not sure if your answer applies here. Can I access `expect` from the actual Python code that’s running?

Cheers,  
Daniel

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [October 4, 2018, 9:35pm UTC](https://forum.ansible.com/t/does-ansible-expose-ansible-become-pass-to-modules/28715/4 "2018-10-04T21:35:25Z")

</div>

No ansible\_become\_pass is not accessible from a module. Only the module options set in the task yaml and a few key internal variables are passed in, like check mode, diff, verbosity.

Thanks

Jordan
