Skip to content

Instantly share code, notes, and snippets.

@philchristensen
Created August 1, 2014 16:20
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 philchristensen/5abed341fd8d178a2aed to your computer and use it in GitHub Desktop.
Save philchristensen/5abed341fd8d178a2aed to your computer and use it in GitHub Desktop.
Gitolite post-update script to auto-update a multi-environment puppetmaster
#!/bin/bash
branch=$(git rev-parse --symbolic --abbrev-ref $1)
module=$(basename $PWD)
valid=0
for modname in site-puppet.git core-puppet.git; do
if [[ "$module" == "$modname" ]]; then
valid=1
fi
done
#exec git update-server-info
if [[ "$valid" == "1" ]]; then
modulename=$(echo $module | cut -d '-' -f 1)
echo "Updating puppet module $modulename for $branch..."
unset GIT_DIR
cd /etc/puppet
git pull
chmod 0644 /etc/puppet/environments/*.json
refresh-modules.py $branch $modulename
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment