September 2018
Beginner to intermediate
214 pages
5h 53m
English
Now that we've learned how to create and encrypt vault files, let's look at how to use them properly with Ansible playbooks and roles. To be able to use encrypted variables, we need to provide Ansible with the password for the Vault file. This can be done simply with an interactive prompt when executing the playbook, as follows:
ansible-playbook playbook.yml --ask-vault-pass
Alternatively, for a more automated method, you could point to the file where the vault password will be stored. This is done as follows:
ansible-playbook playbook.yml --vault-password-file /home/admin/.secrets/vault_pass.txt
The file should be a one-line file containing the password as a string. If there is a site vault password, ...
Read now
Unlock full access