diff --git a/Ansible vault encrypt-decrypt.md b/Ansible vault encrypt-decrypt.md new file mode 100644 index 0000000..72e19c1 --- /dev/null +++ b/Ansible vault encrypt-decrypt.md @@ -0,0 +1,20 @@ +# Ansible vault encrypt/decrypt + +## Encrypt +Echo passwords through `ansible-vault` into a file. Provide encryption password when prompted (can be different for each password) + +```shell +printf "%s" | ansible-vault encrypt_string --stdin-name= > .var.yml +printf "%s" | ansible-vault encrypt_string --stdin-name= >> .var.yml +... +``` + +## Decrypt +Retrieve a single decrytped password from password file. Provide encryption password when prompted. + +```shell +ansible localhost -e '@.var.yml' --ask-vault-pass -m debug -a 'var=' +``` + +Tags: + howto \ No newline at end of file