Last active
August 29, 2015 14:23
-
-
Save steventwheeler/a55a1284851c72b4bdb2 to your computer and use it in GitHub Desktop.
Bootstrap Puppet Agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Example Usage: | |
# curl -sSL https://gist.github.com/steventwheeler/a55a1284851c72b4bdb2/raw/bootstrap_puppet_agent_centos_7.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-7.noarch.rpm | |
yum --assumeyes install puppet-agent | |
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 | |
/opt/puppetlabs/bin/puppet agent -t | |
systemctl enable puppet | |
systemctl start puppet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment