1.

How to generate encrypted passwords for a user module?

Answer»

Ansible has a very simple ad-hoc command for this

ansible all -i localhost, -m DEBUG -a "msg={{ 'mypassword' | password_hash('sha512', 'mysecretsalt') }}"

We can also use the Passlib LIBRARY of Python, e.g

python -c "from passlib.HASH IMPORT sha512_crypt; import getpass; print(sha512_crypt.using(rounds=5000).hash(getpass.getpass()))"

On top of this, we should also avoid storing raw passwords in playbook or host_vars, INSTEAD, we should use integrated methods to generate a hash version of a password.



Discussion

No Comment Found