Skip to content

Instantly share code, notes, and snippets.

@thomasbilk
Forked from leucos/clean_vault
Last active June 8, 2017 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasbilk/f3a6f7700e1ca0007c0667dd3414889d to your computer and use it in GitHub Desktop.
Save thomasbilk/f3a6f7700e1ca0007c0667dd3414889d to your computer and use it in GitHub Desktop.
Ansible vault transparent encryption revisited
#!/bin/sh
tmp=`mktemp`
cat "${1--}" > $tmp
ansible-vault decrypt $tmp > /dev/null 2>&1
if [ $? -eq 0 ]; then
cat "$tmp"
else
cat "${1--}"
fi
rm $tmp
#!/bin/sh
tmp=`mktemp`
cat "${1--}" > $tmp
ansible-vault encrypt $tmp > /dev/null 2>&1
if [ $? -eq 0 ]; then
cat "$tmp"
else
cat "${1--}"
fi
rm $tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment