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.
More on Vault, Privilege Escalation and Error Handling
What is Ansible Vault?BeginnerWhich `ansible-vault` commands do you use day to day?BeginnerWhat is `encrypt_string` and when is it better than encrypting a whole file?IntermediateWhat are vault IDs and why use them?AdvancedHow is Vault data encrypted and what does the file look like?AdvancedHow do you rotate a vault password?Intermediate