Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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