Ansible 2 cheatsheet

Ansible 2: Vault (secrets)

5 common Ansible 2 tasks.

Create an encrypted file

Create a new file that is encrypted at rest. You are asked for a vault password.

ansible-vault create secrets.yml

Edit an encrypted file

Decrypt, edit and re-encrypt a file.

ansible-vault edit secrets.yml

Encrypt an existing file

Encrypt an existing file in place.

ansible-vault encrypt vars/prod.yml

View an encrypted file

Print the decrypted contents without changing the file.

ansible-vault view secrets.yml

Run a playbook that uses vault

Prompt for the vault password when the playbook runs.

ansible-playbook site.yml --ask-vault-pass

Was this page helpful?