I would need to use my --ask-become-pass password in an expect script. Is there any way to use the password entered when starting ansible_playbook in a variable?
Pseudo-code:
# ansible-playbook --become --ask-become-pass -i testing master.yml
BECOME password: secretpassword
then in the task
- name: use pw variable in task
expect:
command: /bin/bash -c "/usr/bin/my_command"
responses:
Password: "{{ prompted_pass }}"
where I would want expect to enter "secretpassword" when reading the "Password" prompt
I know about become_user, unfortunately it does not help in my case as a remote server asks for the password - but it is the same as the become_password.
I tried dumping vars and environment, but could not find anything helpful.
Thanks, Tobias