How do you make sure a password given to `user` module is stored hashed?
BeginnerScenarioSecurity: Vault, Become and Compliance
Answer
Situation read → The user module expects a hash in password:.
What I'd do →
- ansible.builtin.user:
name: svc
password: "{{ vault_svc_pw | password_hash('sha512', 'fixedsalt') }}"
update_password: on_create
Why → A fixed salt keeps the hash stable between runs, or update_password: on_create prevents repeated changes.
Interview tip → Plain text in password: would set a literal (invalid) hash.
More on Security: Vault, Become and Compliance
Database passwords are sitting in plain text in `group_vars`. How do you fix it?BeginnerYou need separate vault passwords for staging and prod.IntermediateHow do you change the vault password for all encrypted files?IntermediateA CI pipeline needs the vault password without storing it in the repo.IntermediateYou want to see the value inside an encrypted file without writing a decrypted copy to disk.BeginnerOnly one value in a vars file is secret and you want it in the same file as plain values.Beginner