Ansible Vault sub-module wrapper for GPG encrypted keys
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
srw 2f3314d94d Filter gpg expired-key notes during vault decrypt
Refactor gpg decrypt into gpg_decrypt with session-aware batch/ask
modes. Suppress routine "secret/public key expired" Note lines on
stderr during normal ansible-vault use. Add keys subcommand to report
vault-key recipients and local keyring status.

Crafted-by: grok
2026-06-29 09:24:18 +00:00
.gitignore sync with github version, add load command to vault-open.sh 2026-05-27 04:28:02 +00:00
ansible.cfg sync with github version, add load command to vault-open.sh 2026-05-27 04:28:02 +00:00
README.md sync with github version, add load command to vault-open.sh 2026-05-27 04:28:02 +00:00
vault-creds.sh add vault-creds.sh 2023-09-28 01:33:41 +00:00
vault-open.sh Filter gpg expired-key notes during vault decrypt 2026-06-29 09:24:18 +00:00
vault-rekey.sh sync with github version, add load command to vault-open.sh 2026-05-27 04:28:02 +00:00

Ansible GPG Vault

Add submodule

git submodule add [email protected]:srwadleigh/ansible-gpg-vault.git vault

Set defaults in ansible.cfg

[defaults]
vault_password_file=vault/vault-open.sh

Create an new vault key

export KEYID=<your-key-id>
pwgen -n 128 -C | head -n1 | gpg --armor --recipient $KEYID -e -o vault/vault-key.gpg

View an ansible vault

ansible-vault --vault-password-file=vault/vault-open.sh view /path/to/an/encrypted/vault/file.yml

Adding an encrypted file

ansible-vault create vault/$HOSTNAME.yml

changing the gpg keys used to encrypt the vault password

gpg -d vault/vault-key.gpg | gpg -e --trust-model always -r "XXXXXXXX" -r "XXXXXXXY" -o vault/vault-key.gpg.new

Viewing encrypted fields

yq -r .some_variable prod/group_vars/all.yml | ansible-vault decrypt