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.
More on Security: Vault, Become and Compliance
Database passwords are sitting in plain text in `group_vars`. How do you fix it?BeginnerHow 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.BeginnerA task needs root on the target but your user has only limited sudo rights.Intermediate