The bootstrap process
In order to prepare a new node for Puppet management using the demo repo, we need to do a number of things:
- Install Puppet
- Clone the Git repo
- Run Puppet for the first time
In Chapter 3, Managing your Puppet code with Git, we performed these steps manually, but the demo repo automates this process (usually known as bootstrap). Here is the bootstrap script (scripts/bootstrap.sh
):
#!/bin/bash PUPPET_REPO=$1 HOSTNAME=$2 BRANCH=$3 if [ "$#" -ne 3 ]; then echo "Usage: $0 PUPPET_REPO HOSTNAME BRANCH" exit 1 fi hostname ${HOSTNAME} echo ${HOSTNAME} >/etc/hostname source /etc/lsb-release apt-key adv --fetch-keys http://apt.puppetlabs.com/DEB-GPG-KEY-puppet wget http://apt.puppetlabs.com/puppetlabs-release-${DISTRIB_CODENAME}.deb dpkg -i puppetlabs-release-${DISTRIB_CODENAME}.deb apt-get update apt-get -y install git puppet-agent cd /etc/puppetlabs/code/environments mv production production.orig git clone ${PUPPET_REPO} production cd production git checkout...