Skip to content

Instantly share code, notes, and snippets.

@bgstack15
Created April 6, 2018 15:48
Show Gist options
  • Save bgstack15/356b7f1013bfe306590567e4c9a2f438 to your computer and use it in GitHub Desktop.
Save bgstack15/356b7f1013bfe306590567e4c9a2f438 to your computer and use it in GitHub Desktop.
Script that enforces ansible ownership of ansible files
#!/bin/sh
ansibleown_version="2018-04-04a"
tu=ansible
tg="$( id -ng "${tu}" )"
for word in $@ ;
do
# set group accessible
find ${word} -exec chown "${tu}:${tg}" {} \; -exec chmod g+rwX {} \;
# set setgid and sticky bits
find ${word} -type d -exec chmod g+s,o+t {} \;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment