I would like to change the root password and the password of some other accounts with ansible. Password is changed: it is no longer the old one, but it doesn't work.
Am I doing something wrong, or have I run into a bug?
The post is here
https://groups.google.com/g/ansible-project/c/5dXLPJWKPRg/m/5As6ZfVuBwAJ
BTW: I was searching for a stack exchange site, but there isn't one for ansible, those are very handy for end users to help each other. Very good searchable.
I think there is a need.
https://stackexchange.com/sites#
Hey you can try using the verbose or else while creating the user you can give the password.
Thanks for the reply.
What do you mean with verbose? Code example?
I need to change the password of existing users, on >200 machines, in a safe way.
I was following this procedur
https://docs.ansible.com/ansible/latest/reference_appendices/faq.html
I think you are hashing your password twice, and that is wrong:
ansible localhost -m user -a "name=jopy update_password=always password={{ '$6$sTmb9Vaxxd9fOGyC$AueAkwgO1M.qnKtKrtAFuPN5iTt0h.Dl1DcLSx9a/fqGTpltbuWAB3ZO.wsQOJTH95l3DIz/blpKFDezAzXhL.' | password_hash('sha512') }}" -u root
This should work:
ansible localhost -m user -a "name=jopy update_password=always password= '$6$sTmb9Vaxxd9fOGyC$AueAkwgO1M.qnKtKrtAFuPN5iTt0h.Dl1DcLSx9a/fqGTpltbuWAB3ZO.wsQOJTH95l3DIz/blpKFDezAzXhL.'" -u root
Thanks for the input Fran, but it didn't work for me. (BTW: I use selection cp/paste buffer (=middle mouse button, after classic password change, it works)
Did it work for you?
The format is correct the problem is you are allready hasing the password and again using the sha512 so seems like this is creating the issue just give the normal password or you can use the variable is you are using vault to hide. And the verbose is just using -vvvv with the command it will give more clearity what is happening behind the sence.
Hope this would help you!
This worked:
ansible localhost -m user -a "name=jopy update_password=always password={{ 'Een.voorbeeld.passwoord' | password_hash('sha512') }}" -u root
That will have to do it then I guess
ansible -i hostfile all -m user -a "name=admin update_password=always password={{ newpassword|password_hash('sha512') }}" -b --extra-vars "newpassword=12345678"
Try using this command.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.