Skip to main content

Installation and Setup

Courses:

Installation

You can follow the instructions based on your OS, but here is the instructions for Debian-based systems:

source (includes multi-node setup)

wget https://apt.puppet.com/puppet7-release-focal.deb
sudo dpkg -i puppet7-release-focal.deb
sudo apt-get update -y
# for puppet server:
sudo apt-get install puppetserver -y
# for puppet agent:
sudo apt-get install puppet-agent -y

Setup Configuration

Before anything, set up host resolution for master and agent:

sudo nano /etc/hosts
# format: [puppet master ip] master.puppet.vm puppet
# format: [puppet client ip] agent.puppet.vm

Look at the puppet installation configurations:

sudo nano /etc/default/puppetserver

In the JAVA_ARGS section, you can update -Xms and -Xmx to change the amount of memory puppet is taking.

Then, start the puppetserver:

sudo systemctl start puppetserver
sudo systemctl status puppetserver
sudo systemctl enable puppetserver

Note: If there was error with permission creating folders, change the owner of puppet folder:

sudo chown -R puppet:puppet /etc/puppetlabs/

Then, we can change which puppet server the client is going to point to (can be itself):

sudo nano /etc/puppetlabs/puppet/puppet.conf

Then, we can add something like this (to point to itself):

[agent]
server = master.puppet.vm

or for the client:

[main]
certname = agent.puppet.vm
server = master.puppet.vm

Add the ruby installed with puppet to the PATH in .bashrc:

PATH=$PATH:/opt/puppetlabs/puppet/bin

Test the installation by using gem. Install the package r10k:

# r10k can be used to get the GitHub config down to our server
gem install r10k

Then, run the agent to test installation and configuration:

sudo puppet agent -t

Sign the certificates for agents using:

sudo puppetserver ca sign --all

Setup Control Repo

In this stage, we will setup the control repo using r10k:

mkdir /etc/puppetlabs/r10k
nano /etc/puppetlabs/r10k/r10k.yaml

Paste the following into the r10k.yaml file:

---
# The location to use for storing cached Git repos
:cachedir: '/var/cache/r10k'

# A list of git repositories to create
:sources:
  # This will clone the git repository and instantiate an environment per
  # branch in /etc/puppetlabs/code/environments
  :my-org:
    remote: 'https://github.com/$YOUR_GITHUB_USERNAME$/control-repo.git'
    basedir: '/etc/puppetlabs/code/environments'

Then, we can use the r10k command to deploy the repo:

r10k deploy environment -p

Check the progress in our environments:

cd /etc/puppetlabs/code/environments/
ls
# we should have our branches here