Created
July 31, 2019 11:27
-
-
Save kenorb/dea25e154658fd09442d4591bf6f3897 to your computer and use it in GitHub Desktop.
ansible-keyring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#/ | |
#/ Fetch Ansible vault password from GNOME keyring | |
#/ | |
#/ How to configure: | |
#/ Set name of the VAULT_ID for the current Git repo: git config --local ansible.vault VAULT_ID | |
#/ Set password with GNOME keyring: keyring set ansible VAULT_ID | |
#/ Set environment variable ANSIBLE_VAULT_PASSWORD_FILE to the location of this file | |
set -eu | |
# | |
# Display usage of the script, which is a specially marked comment | |
# | |
usage() { | |
grep '^#/' <"$0" | cut -c 4- | |
} | |
DEFAULT_VAULT_ID=vault_password | |
VAULT_ID=$(git config --get ansible.vault || echo "${DEFAULT_VAULT_ID}") | |
/usr/bin/keyring get ansible "${VAULT_ID}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment