diff options
Diffstat (limited to 'global/pre-tasks.d/030puppet')
-rwxr-xr-x | global/pre-tasks.d/030puppet | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/global/pre-tasks.d/030puppet b/global/pre-tasks.d/030puppet new file mode 100755 index 0000000..2dc0b80 --- /dev/null +++ b/global/pre-tasks.d/030puppet @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Re-used example from SJD +# + +set -e + +stamp="$COSMOS_BASE/stamps/puppet-tools-v01.stamp" + +if ! test -f $stamp -a -f /usr/bin/puppet; then + codename=`lsb_release -c| awk '{print $2}'` + wget -c http://apt.puppetlabs.com/puppetlabs-release-${codename}.deb + dpkg -i puppetlabs-release-${codename}.deb + rm -f puppetlabs-release-${codename}.deb* + apt-get update + apt-get -y install puppet-common + + mkdir -p `dirname $stamp` + touch $stamp +fi + +python -c "import yaml" 2>/dev/null || apt-get -y install python-yaml + +if [ -f /etc/puppet/cosmos-modules.conf ]; then + grep -E -v "^#" /etc/puppet/cosmos-modules.conf | ( + cd /etc/puppet/modules && while read module src update; do + if [ ! -d /etc/puppet/modules/$module ]; then + echo $src | grep -q "://" && git clone $src $module || puppet module install $src + else + if [ "x$update" = "xyes" ]; then + echo $src | grep -q "://" && (cd /etc/puppet/modules/$module && git pull -q) || puppet module upgrade $src + fi + fi + done) +fi |