ansible-pre-commit/encryption-check.sh

18 lines
320 B
Bash
Executable File

#! /bin/bash
# Verifies that files passed in are encrypted
set -e
has_error=0
for file in $@ ; do
head -1 "$file" | grep --quiet '^\$ANSIBLE_VAULT;' || {
echo "ERROR: $file is not encrypted"
has_error=1
}
done
if [ $has_error ] ; then
echo "To ignore, use --no-verify"
fi
exit $has_error