Interview Prep/Ansible/Vault, Privilege Escalation and Error Handling

What are vault IDs and why use them?

AdvancedConceptVault, Privilege Escalation and Error Handling
Answer

A vault ID labels a vault password, so you can use different passwords per environment and supply several at once.

ansible-vault encrypt --encrypt-vault-id prod group_vars/prod/vault.yml
ansible-playbook site.yml \
  --vault-id dev@~/.vault_dev \
  --vault-id prod@prompt

The label is stored in the file header ($ANSIBLE_VAULT;1.2;AES256;prod). Ansible tries the matching ID first and then falls back to the other supplied passwords. It is not a security boundary on its own, but it lets a team give developers only the dev password while CI holds prod.

All Ansible questions Roadmap: Ansible

More on Vault, Privilege Escalation and Error Handling