Hello, I'm very new to ansible. So, please bare with me if I ask some beginners questions.
I try to set a user password using the ansible ad-hoc mode with the user-module <http://docs.ansible.com/ansible/user_module.html>. To generate the password has I use the python command mentioned in the FAQ here <http://docs.ansible.com/ansible/faq.html#how-do-i-generate-crypted-passwords-for-the-user-module>. Using the python command to generate a password hash produces a hash like this: $6$rounds=100000$nu.kkTNOWqlbz.6T$JtYE/77zl9p... This is a short version from the complete string. I try to set the password with the following command: ansible localhost -m user -a "name=johnd password='$6$rounds=100000$nu.kkTNOWqlbz.6T$JtYE/77zl9p...' state=present" But when I lookup the has in /etc/shadow it looks like: >grep 'johnd' /etc/shadow johnd:=100000$nu.kkTNOWqlbz.6T$JtYE/77zl9p:16976:0:99999:7::: The following part of the hash string is missing: $6$rounds= And just now I figured out, that the python command generates a different has every time for the same password: root@hostname>python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())" Password: $6$rounds=100000$GQDbqHk4Y1bcLF8t$PjC0r5o.B75. buNFvcOhSp2SdB4zRTfVlbrQ2u7aN5W9L5h1UqOaGMHAYtR.QvmcmUF2vLGSfAR30fYwcvvzJ. [2016.06.24 09:35:18] ~ root@hostname>python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())" Password: $6$rounds=100000$t57obQLCBDhu.0Hx$ffsDGXXLuAjCnl5Mv7wLoZuzcJqkw.wJ0NQn1/ K9bP9hu4dH4gZmZQ0GXb.7lsBSmAOSeo26IJqNlGq90MALP0 [2016.06.24 09:35:27] ~ root@hostname>python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())" Password: $6$rounds=100000 $yLMPFyCM2ZmftBaX$QP3uBV7WHUjrD2G0xO7VXIdILivE0Y1pgbLrlgRBicD3e7dRNSx1cCF1FEeOLzPLK .AuuSGVQESwpixlWj8o01 [2016.06.24 09:35:35] ~ Unfortunately there is no mkpasswd --method=SHA-512 available on my red hat system. Could you explain how I could generate a password hash to use with the ansible user module, please? Kind regards, Joerg K. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e23c16b7-cbe7-4cbc-86c6-c8f5be743a7d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
