Creating and editing encrypted files
To create new files, Ansible provides a program called ansible-vault
. This program is used to create and interact with Vault-encrypted files. The subcommand to create encrypted files is create
, and you can see the options available under this subcommand by running the following command:
ansible-vault create --help
The output of this command is shown in the following screenshot:
To create a new file, you'll need to know two things ahead of time. The first is the password ansible-vault
will be using to encrypt the file, and the second is the filename itself. Once provided with this information, ansible-vault
will launch a text editor (as defined in the EDITOR
environment variable—this defaults to vi
or vim
in many cases). Once you save the file and exit the editor, ansible-vault
will use the supplied password as a key to encrypt...