Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- PUPBASE="/opt/contegix/puppet"
- PUPAGENT="${PUPBASE}/etc/init.d/puppet-agent"
- PUPEXEC="${PUPBASE}/bin/puppet"
- PUPCFG="${PUPBASE}/etc/puppet/puppet.conf"
- PUPSYSC="${PUPBASE}/etc/sysconfig/puppet"
- ## check that we even have a puppet directory
- if [ ! -d "$PUPBASE" ]; then
- echo "Warning: No puppet directory. Exiting..."
- exit 1
- fi
- ## check to ensure we have all the tools needed
- if [ -f "$PUPAGENT" ] && [ -f "$PUPEXEC" ] && [ -f "$PUPCFG" ]; then
- NEEDSWORK=$($PUPEXEC config print | grep '^server.*puppet-master01')
- if [ -z "$NEEDSWORK" ]; then
- "$PUPAGENT" stop
- CERTDIR=$($PUPEXEC agent --configprint ssldir)
- if [ -d "$CERTDIR" ]; then rm -rf "$CERTDIR"; fi
- sed -i "s/puppet\.contegix\.svc/puppet-master01.contegix.com/g" "$PUPCFG"
- if [ -f "$PUPSYSC" ]; then sed -i "s/puppet\.contegix\.svc/puppet-master01.contegix.com/g" "$PUPSYSC"; fi
- "$PUPEXEC" agent -t --server puppet-master01.contegix.com --environment production --noop | grep -v 'Loading facts'
- "$PUPAGENT" start
- else
- echo "$(hostname) is already updated."
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement