Puppet Agent (client) copy-paste script for Debian and Ubuntu

This is a simple script you can copy and paste to your console to install puppet on a new host. You just need to edit the first two lines with the server information and then sign the requested certificate on the puppet master.

# Stefan Süss
# www.sysstem.at
#you only need to edit these 2 lines
DEBIAN_RLS=$(cat /etc/os-release | grep VERSION= | awk -F '('  '{print $2}' | awk -F ')' '{print $1}')
#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
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

You can also find the script here: Github

One thought on “Puppet Agent (client) copy-paste script for Debian and Ubuntu”

  1. I’ve been following this amazing website for the past few days, it serves up great content for viewers. The site owner works hard to engage visitors. I’m a big fan and hope they keep up the good work!

Leave a Reply

Your email address will not be published. Required fields are marked *