Skip to content

Instantly share code, notes, and snippets.

@steventwheeler
Last active June 14, 2016 16:23
Show Gist options
  • Save steventwheeler/56b3d39505ea70ded9c7b2d4e1993cd9 to your computer and use it in GitHub Desktop.
Save steventwheeler/56b3d39505ea70ded9c7b2d4e1993cd9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Example Usage:
# curl -sSL https://gist.github.com/steventwheeler/56b3d39505ea70ded9c7b2d4e1993cd9/raw/bootstrap_puppet_agent_centos_6.sh | bash -s <PUPPET_MASTER_SERVER>
if [[ $EUID -ne 0 ]] ; then
echo "This script must be run as root."
exit 1
fi
yum --assumeyes install http://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm
yum --assumeyes install puppet-agent ntp
if [ ! -z "$1" ] ; then
echo "PUPPET_SERVER=$1" > /etc/sysconfig/puppet
if [ -z "$(grep server /etc/puppetlabs/puppet/puppet.conf)" ] ; then
echo "[main]" >> /etc/puppetlabs/puppet/puppet.conf
echo "server = $1" >> /etc/puppetlabs/puppet/puppet.conf
fi
fi
chkconfig ntpd on
service ntpd start
/opt/puppetlabs/bin/puppet agent -t
chkconfig puppet on
service puppet start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment