Ansible - ansible-vault edit command

The ansible-vault command can be used to perform a number of tasks.

Additionally, there are a few command line options to be aware of.


The ansible-vault edit command can be used to edit a file that has been encrypted by the ansible-vault command. Let's say foo.yml is encrypted.

Before editing the file, you'll want to determine if the file was encrypted using a certain vault it. In this example, the file was encrypted using the "test" id.

~]$ cat foo.txt


The following command can be used to edit foo.txt.

ansible-vault edit foo.txt


You will be prompted for the vault password.

Vault password:


Or, to avoid being prompted for the vault password, if the file is not associated with a vault id, the --vault-password-file command line option can be used.

ansible-vault edit --vault-password-file /usr/local/vault/.vault_password.txt foo.txt


If the file is associated with a vault id, the --vault-id command line option can be used.

ansible-vault edit --vault-id test@/usr/local/ansible/vault/.vault_password.txt foo.txt


After providing the valid vault password, the file will open in your default editor, and you will be able to modify the file.


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 4e926 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |