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

How do you supply the vault password when running a playbook?

BeginnerConceptVault, Privilege Escalation and Error Handling
Answer
ansible-playbook site.yml --ask-vault-pass
ansible-playbook site.yml --vault-password-file ~/.vault_pass
export ANSIBLE_VAULT_PASSWORD_FILE=~/.vault_pass

The password file must have mode 600 and stay out of Git (.gitignore). If the file is executable, Ansible runs it and reads the password from stdout. That is how teams fetch the password from a secrets manager or keychain without storing it on disk.

All Ansible questions Roadmap: Ansible

More on Vault, Privilege Escalation and Error Handling