ansible-vault is a command line utility that permits to add/get sensitive data (file or property value) into an encrypted format called a vault
Example of sensitive data:
When running a playbook, Ansible finds:
Encrypted data can include
The vault id used with vault currently must be the same for all files you wish to use together at the same time.
Usage: ansible-vault [create|decrypt|edit|encrypt|encrypt_string|rekey|view] [options] [vaultfile.yml]
encryption/decryption utility for Ansible data files
Options:
--ask-vault-pass ask for vault password
-h, --help show this help message and exit
--new-vault-id=NEW_VAULT_ID
the new vault identity to use for rekey
--new-vault-password-file=NEW_VAULT_PASSWORD_FILE
new vault password file for rekey
--vault-id=VAULT_IDS the vault identity to use
--vault-password-file=VAULT_PASSWORD_FILES
vault password file
-v, --verbose verbose mode (-vvv for more, -vvvv to enable
connection debugging)
--version show program's version number and exit
See 'ansible-vault <command> --help' for more information on a specific
command.
When encrypting content one vault-id can be used.
Encrypt a property value. See Ansible - Encrypt a property (password, private key)
ansible-vault encrypt
Decrypt a property value. See Ansible - Decrypt a property (password, private key)
ansible-playbook --vault-id dev@dev-password site.yml
ansible-playbook --vault-password-file dev-password site.yml
Example
ansible-playbook --vault-id /path/to/my/vault-password-file site.yml
ansible-playbook --vault-id dev@prompt site.yml
# Prior to Ansible 2.4
ansible-playbook --ask-vault-pass site.yml
Example:
ansible-playbook --vault-id @prompt site.yml
To get the password from a vault password executable script my-vault-password.py:
ansible-playbook --vault-id my-vault-password.py
Your vault passphrase is not the good one.