Creating a user password to be stored in your Ansible script

In order to set a password in Ansible, the password has to be hashed and then assigned to the password field in the user module. Run the following from your command line to generate the password hash


Install PassLib

sudo pip install passlib

Run the following script

python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"

Enter your password in plain text

Save your password to a variable or assign it to a task in Ansible



Opinions about People, Process and Technology

Optimization WordPress Plugins & Solutions by W3 EDGE