Interview Prep/Ansible/Security: Vault, Become and Compliance

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.

All Ansible questions Roadmap: Ansible

More on Security: Vault, Become and Compliance