I want to use ansible vault. Since I do not want to store my vault key in a file and I do not want to type it in every time I run a playbook, I wonder, if I can do this:
Store the vault key in an environment variable for example ANSIBLE_VAULT_KEY
This gets used everytime I run a playbook. When I am finished, I close the session or empty the variable.
What do you think? Is it possible? That would speed up my workflow and make my installation much faster.
Side note, i have also written small script to use GPG to decrypt my passphrase from disk. See this gist
On first run it will generate random 128 character key and store it encrypted for recipients in the ANSIBLE_VAULT_PASSPHRASE_RECIPIENTS enviroment variable at .vault-passhrase.gpg.
Later os will prompt me for the gpg key passphrase once and subsequent runs it’s cached.
You can also manually create passphrase file with your own, like so: