Hi, I am relatively new with Ansible.
This is my requirement: I have a list of some thousand instances which i need to connect as ‘su’ user and run a playbook for these instances. For each instance I need to enter the password manually. In order to avoid this, though it is not strongly recommended i am using the vault to specify my password. But still I am not able to run the playbook.
Following are the code snippets:
Call to playbook:
ansible-playbook ${privilege_opts} -l ${groups_opts} -i ${inventory_opts} ${playbook} --vault-password-file ~/vault.txt
In ‘vault.txt’ i have given a single string password. (E.g: abc)
The playbook has the following file included:
vars_files:
- red
‘red’ is the file where my actual password is there like this:
ansible-su-pass: mypassword
When i run the playbook it just hangs. What i found interesting here is that, this approach absolutely works fine for ‘sudo’. I am wondering why this does not work for ‘su’. Am i missing something
Greatly appreciate your help!