myuri
myuri

Reputation: 21

Ansible - Passing password to playbook command which uses --ask-become-pass option

My command line is

ansible-playbook *playbook-name* --ask-become-pass

In this case ansible will ask for the password.

I want to use the same command but without having to put the password interactively. something like

ansible-playbook *playbook-name* --ask-become-pass < password

(which don't work of course)

Upvotes: 1

Views: 4220

Answers (1)

myuri
myuri

Reputation: 21

I have fixed my issue by removing the --ask-become-pass option and i set the ansible_become_pass variable in my inventory (and encrypted the password by vault). Therefore, during the sudo operation ansible use the password i provided to "become" another user

Upvotes: 1

Related Questions