Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Copy-paste script for puppet on Debian/Ubuntu
# Stefan Süss
# www.sysstem.at
#you only need to edit these 2 lines
SERVER_IP=10.0.0.100
SERVER_DNS=puppet.sysstem.at
DEBIAN_RLS=$(cat /etc/os-release | grep VERSION= | awk -F '(' '{print $2}' | awk -F ')' '{print $1}')
PUPPET_DEB=puppetlabs-release-$DEBIAN_RLS.deb
PUPPET_CONF=/etc/puppet/puppet.conf
#add server IP to hosts
echo "$SERVER_IP $SERVER_DNS" >> /etc/hosts
#download the right release of puppet
wget https://apt.puppetlabs.com/$PUPPET_DEB
#install the package
dpkg -i $PUPPET_DEB
#update sources
apt-get update
#install puppet. Needs /dev/null . otherwise it would catch the pasted input
apt-get -y install puppet < "/dev/null"
#remove templatedir
sed -i 's/templatedir/#templatedir/g' $PUPPET_CONF
#insert server
#http://www.theunixschool.com/2012/06/insert-line-before-or-after-pattern.html
sed -i "s/.*#templatedir.*/&\nserver=${SERVER_DNS}/" $PUPPET_CONF
#start puppet agent for the first time (generates the certificate)
puppet agent --onetime --verbose --no-daemonize --waitforcert 1
#newline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment