Skip to content

Instantly share code, notes, and snippets.

@zioproto
Created July 4, 2018 11:50
Show Gist options
  • Save zioproto/6aad9dc9ab9d24ba452f58045c251d27 to your computer and use it in GitHub Desktop.
Save zioproto/6aad9dc9ab9d24ba452f58045c251d27 to your computer and use it in GitHub Desktop.
Git hook to avoid committing a decrypted ansible vault
#!/bin/bash
git show :group_vars/all/vault | grep ^'$ANSIBLE_VAULT'
export encrypted=$?
if [ $encrypted -ne 0 ]; then
echo Ansible Vault not encrypted, refusing to commit
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment