Technical Documentation

Quick Start Manual Puppet Server Deployment

By 29/03/2017 April 20th, 2019 No Comments

A quick start guide covering manual Puppet Server installation, PuppetDB deployment and basic Puppet usage.

Aptira Puppet Server Installation & Puppet Server Deployment

Puppet Server Installation

Install the Puppet Server:
# yum -y install https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
# yum makecache
# yum install -y puppetserver
# systemctl enable puppetserver
# systemctl start puppetserver

Check the status of the Puppet Server:
# systemctl status puppetserver

and ensure that the Puppet Server is listening on port 8140:
# ss -l -t '( sport = 8140 )'
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 :::8140 :::*

PuppetDB Deployment

Install PuppetDB and PostgreSQL 9.6 Server:
# yum install -y \
https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
# yum install -y puppetdb puppetdb-termini postgresql96-server postgresql96-contrib

Edit /etc/puppetlabs/puppet/puppetdb.conf so that it contains the following, where puppet.example.com matches your puppet servers hostname:
[main]
server_urls = https://puppet.example.com:8081

Add the following three lines to /etc/puppetlabs/puppet/puppet.conf:
[master]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code
reports = store,puppetdb
storeconfigs = true
storeconfigs_backend = puppetdb

Set up postgres and create a PuppetDB user as follows. Remember the password when running createuser.
# /usr/pgsql-9.6/bin/postgresql96-setup initdb
# systemctl start postgresql-9.6
# sudo -u postgres sh
# createuser -DRSP puppetdb
# createdb -E UTF8 -O puppetdb puppetdb
# psql puppetdb -c 'create extension pg_trgm'
# exit

Edit /var/lib/pgsql/9.6/data/pg_hba.conf to contain the following:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5

Modify /etc/puppetlabs/puppetdb/conf.d/database.ini to contain the following. Use the password from the createuser step above.

[database]
classname = org.postgresql.Driver
subprotocol = postgresql
# The database address, i.e. //HOST:PORT/DATABASE_NAME
subname = //localhost:5432/puppetdb
# Connect as a specific user
username = puppetdb
# Use a specific password
password = PASSWORD

Create /etc/puppetlabs/puppet/routes.yaml to contain the following:
master:
facts:
terminus: puppetdb
cache: yaml

and ensure the ownership is correct:
# chown puppet:puppet /etc/puppetlabs/puppet/routes.yaml

Finally, enable the PuppetDB and PostgreSQL services, start PuppetDB, and restart both PostgreSQL and Puppet Server:
# systemctl enable puppetdb
# systemctl enable postgresql-9.6
# systemctl start puppetdb
# systemctl restart postgresql-9.6
# systemctl restart puppetserver

Puppet Usage

The basic puppet usage is as follows for a new client:

On the puppet client, request a certificate:
# yum -y install puppet
# puppet agent -t --server puppet.example.com

On the puppet server, approve the certificate:
# puppet cert list
# puppet cert sign CLIENT_HOSTNAME

On the puppet client, run the agent again:
# puppet agent -t --server puppet.example.com

Become more agile.
Get a tailored solution built just for you.

Find Out More

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.