Interview Prep/Ansible/Vault, Performance and Execution Behaviour

Both `--vault-id [email protected]` and `--vault-id prod@prompt` are passed, and prod files still fail to decrypt

IntermediateTroubleshootingVault, Performance and Execution Behaviour
Answer

Likely causes → The vault ID label is only a hint. Ansible tries every supplied secret, so a failure means none of them is right. The file was probably encrypted with a different password than the one now called "prod", for example by someone who forgot --encrypt-vault-id. With vault_id_match = True, only the secret whose label matches the file header is tried.

Diagnose → head -1 on the file shows the label it was encrypted with. If it has no label (1.1 format), it was encrypted without an ID.

Fix → Re-key the file to the correct ID:

ansible-vault rekey --vault-id old@prompt --new-vault-id prod@prompt file.yml

Prevent → Set encrypt_vault_id = prod in each environment's ansible.cfg, or wrap encryption in a script that always passes --encrypt-vault-id.

All Ansible questions Roadmap: Ansible

More on Vault, Performance and Execution Behaviour