Skip to content

Instantly share code, notes, and snippets.

@brunocarvalhodearaujo
Forked from zioproto/pre-commit
Last active January 20, 2024 14:16
Show Gist options
  • Save brunocarvalhodearaujo/57df0fe8ee1b4d9589007e38b3d9ff0f to your computer and use it in GitHub Desktop.
Save brunocarvalhodearaujo/57df0fe8ee1b4d9589007e38b3d9ff0f 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.yml | 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