I’m trying to fix #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?
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.
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?
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.