I have got a lot of systems having a common username to login. The password is also same for most of the systems. I have 1 inventory file with all the systems. For the systems that have a different password, I have saved the password against the hostname, and for the remaining it is in the group_vars file.
In inventory file:
hostname1 ansible_ssh_pass=pass1
hostname2 ansible_ssh_pass=pass2
hostname3
hostname4
group_vars file:
ansible_user: someuser
ansible_ssh_pass: pass3
I do not have higher priviledges. From another thread I was able to figure out how to only use passwd to change the password, and not use other utilities.
shell: 'printf "%s\n" OldPass NewPass NewPass | passwd'
The passwd does not support the "-p" option.
I am trying to figure out a way to get the OldPass value from the same where ansible is picking it for each host so that I do not have to run this playbook n number of times, and manually put the OldPass in the shell command.
Please advice on how to proceed with this.
Thanks.