Skip to content

Instantly share code, notes, and snippets.

View e2thenegpii's full-sized avatar

Thomas Eldon Allred e2thenegpii

View GitHub Profile
@e2thenegpii
e2thenegpii / pre-commit
Created October 19, 2016 01:18
git pre-commit hook to make sure all files with a given filename are encrypted with ansible-vault
#!/bin/bash
encryptedIndicator="$ANSIBLE_VAULT"
encryptedFilename="encrypted.yml"
sbe=`find $PWD -name $encryptedFilename | sort -u`
encrypted=`find $PWD -name $encryptedFilename -exec grep "$encryptedIndicator" {} -l \;| sort -u`
shouldbe=`comm -3 <(printf '%s\n' "${sbe[@]}") <(printf '%s\n' "${encrypted[@]}")`