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

You need separate vault passwords for staging and prod.

IntermediateScenarioSecurity: Vault, Become and Compliance
Answer

Situation read → Different trust domains.

What I'd do → Use vault IDs.

ansible-vault encrypt --vault-id staging@prompt group_vars/staging/vault.yml
ansible-vault encrypt --vault-id prod@~/.vault_prod group_vars/prod/vault.yml
ansible-playbook site.yml --vault-id staging@~/.vault_stg --vault-id prod@~/.vault_prod

Why → Each file's header carries its label, and Ansible tries the matching password, so developers can hold staging only.

Interview tip → Production vault password lives in CI/AWX credentials, not on laptops.

All Ansible questions Roadmap: Ansible

More on Security: Vault, Become and Compliance