Today we will explore installation of Puppet Master / Server on CentOS 8 | RHEL 8 Linux machine. A separate guide on the installation and configuration of Puppet Agent will be published as well. Puppet operates in an agent-master architecture, in which a master node controls configuration information for a fleet of managed agent nodes.
The Puppet Server performs the role of the master node. Puppet Server is a Ruby and Clojure application that runs on the Java Virtual Machine (JVM) and provides the same services as the classic Puppet master application. It mostly does this by running the existing Puppet master code in several JRuby interpreters, but it replaces some parts of the classic application with new services written in Clojure.
There are two editions of Puppet:
- Puppet Enterprise (PE)
- Puppet Open Source
If you’re going for a Puppet Enterprise edition, its architecture is as shown below.
The Puppet platform comprises of the following components:
Package | Contents |
---|---|
puppetserver |
Puppet Server . This controls configuration information for a fleet of managed agent nodes |
puppetdb |
PuppetDB – collects data generated by Puppet . It enables advanced Puppet features like exported resources. |
puppet-agent |
Puppet, Facter, Hiera, the PXP agent, root certificates, and prerequisites like Ruby and Augeas. The agent runs on any node in Puppet cluster. |
puppetdb-termini |
Plugins to connect your master to PuppetDB |
Install Puppet 6.x Master on CentOS 8 / RHEL 8
There are many ways of installing Puppet Master on CentOS 8 Linux system. The common and easiest method is pulling the packages required from the YUM repository provided and maintained by Puppet.
Step 1: Update CentOS machine
Ensure your CentOS 8 machine is updated:
sudo dnf -y update
sudo dnf -y install wget curl vim bash-completion
As update includes latest kernel packages, consider rebooting the machine if no critical applications are running in it.
sudo systemctl reboot
Step 2: Set System Hostname and Configure Chrony
Set a proper hostname for your machine.
sudo hostnamectl set-hostname puppetmaster.example.com
Ensure the hostname has proper DNS record and also update /etc/hosts file.
echo "192.168.122.12 puppetmaster.example.com puppetmaster" | sudo tee -a /etc/hosts
Where:
- 192.168.122.12 is the IP Address of Puppet Server
- puppetmaster.example.com is the FQDN of Puppet Server
Restart hostnamed service.
sudo systemctl restart systemd-hostnamed
Logout then login again to confirm the hostname.
$ exit
$ hostname
puppetmaster.example.com
Configure Chrony NTP
$ sudo dnf -y install chrony
$ sudo systemctl enable --now chronyd
$ sudo timedatectl set-timezone Africa/Nairobi --adjust-system-clock
$ sudo timedatectl set-ntp yes
Confirm date and time is correctly configured.
$ timedatectl
Local time: Sat 2020-04-18 14:33:26 EAT
Universal time: Sat 2020-04-18 11:33:26 UTC
RTC time: Sat 2020-04-18 11:33:25
Time zone: Africa/Nairobi (EAT, 0300)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Step 3: Add Puppet Yum repository
Add the repository required by running the command below in your terminal.
sudo dnf -y install https://yum.puppet.com/puppet-release-el-8.noarch.rpm
Also consider adding EPEL repository:
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Step 4: Install Puppet Master / Server on CentOS 8 / RHEL 8
With all the pre-reqs configured, you can begin the installation of Puppet Master on CentOS 8 / RHEL 8 Linux.
Update Package list cache:
$ sudo dnf makecache
CentOS-8 - AppStream 4.2 kB/s | 4.3 kB 00:01
CentOS-8 - Base 5.7 kB/s | 3.8 kB 00:00
CentOS-8 - Extras 1.8 kB/s | 1.5 kB 00:00
CentOS-8 - PowerTools 7.0 kB/s | 4.3 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 24 kB/s | 39 kB 00:01
Puppet Repository el 8 - x86_64 3.3 kB/s | 2.5 kB 00:00
Metadata cache created.
Puppet repository should be in the list of repositories available in the system.
$ sudo dnf repolist
Last metadata expiration check: 0:00:30 ago on Sat 18 Apr 2020 02:36:49 PM EAT.
repo id repo name status
AppStream CentOS-8 - AppStream 5,281
BaseOS CentOS-8 - Base 2,231
PowerTools CentOS-8 - PowerTools 1,533
*epel Extra Packages for Enterprise Linux 8 - x86_64 5,315
extras CentOS-8 - Extras 15
puppet Puppet Repository el 8 - x86_64 148
You can query a list of Puppet packages available on the repository:
$ sudo dnf search puppet
Last metadata expiration check: 0:04:41 ago on Sat 18 Apr 2020 02:36:49 PM EAT.
============================================================ Name & Summary Matched: puppet ============================================================
puppetdb.noarch : Puppet Labs puppetdb
puppetdb-termini.noarch : Termini for puppetdb
puppetserver.noarch : Puppet Labs puppetserver
puppet-release.noarch : Release packages for the Puppet repository
puppet-release.noarch : Release packages for the Puppet repository
puppet6-release.noarch : Release packages for the Puppet 6 repository
python3-collectd_puppet.noarch : Collectd plugin to monitor puppet agents
puppet-agent.x86_64 : The Puppet Agent package contains all of the elements needed to run puppet, including ruby, facter, and hiera.
================================================================= Name Matched: puppet =================================================================
puppet-bolt.x86_64 : Stand alone task runner
=============================================================== Summary Matched: puppet ================================================================
pdk.x86_64 : Puppet Development Kit
Install Puppet Master packages on CentOS 8 Linux.
sudo dnf install puppetserver
Puppet Agent will be installed as a dependency:
Last metadata expiration check: 0:05:03 ago on Sat 18 Apr 2020 02:36:49 PM EAT.
Dependencies resolved.
========================================================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================================================
Installing:
puppetserver noarch 6.10.0-1.el8 puppet 60 M
Installing dependencies:
copy-jdk-configs noarch 3.7-1.el8 AppStream 27 k
java-1.8.0-openjdk-headless x86_64 1:1.8.0.242.b08-0.el8_1 AppStream 33 M
javapackages-filesystem noarch 5.3.0-1.module_el8.0.0 11 5b8c10bd AppStream 30 k
libjpeg-turbo x86_64 1.5.3-10.el8 AppStream 156 k
lua x86_64 5.3.4-11.el8 AppStream 193 k
tzdata-java noarch 2019c-1.el8 AppStream 189 k
lksctp-tools x86_64 1.0.18-3.el8 BaseOS 100 k
net-tools x86_64 2.0-0.51.20160912git.el8 BaseOS 323 k
puppet-agent x86_64 6.14.0-1.el8 puppet 25 M
Enabling module streams:
javapackages-runtime 201801
Transaction Summary
========================================================================================================================================================
Install 10 Packages
Total download size: 119 M
Installed size: 208 M
Is this ok [y/N]: y
On RHEL 8:
Dependencies resolved.
========================================================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================================================
Installing:
puppetserver noarch 6.10.0-1.el8 puppet 60 M
Installing dependencies:
puppet-agent x86_64 6.14.0-1.el8 puppet 25 M
javapackages-filesystem noarch 5.3.0-1.module el8 2447 6f56d9a6 rhel-8-for-x86_64-appstream-rpms 30 k
copy-jdk-configs noarch 3.7-1.el8 rhel-8-for-x86_64-appstream-rpms 27 k
tzdata-java noarch 2019c-1.el8 rhel-8-for-x86_64-appstream-rpms 189 k
libjpeg-turbo x86_64 1.5.3-10.el8 rhel-8-for-x86_64-appstream-rpms 156 k
lua x86_64 5.3.4-11.el8 rhel-8-for-x86_64-appstream-rpms 193 k
java-1.8.0-openjdk-headless x86_64 1:1.8.0.242.b08-0.el8_1 rhel-8-for-x86_64-appstream-rpms 33 M
lksctp-tools x86_64 1.0.18-3.el8 rhel-8-for-x86_64-baseos-rpms 100 k
avahi-libs x86_64 0.7-19.el8 rhel-8-for-x86_64-baseos-rpms 63 k
cups-libs x86_64 1:2.2.6-28.el8 rhel-8-for-x86_64-baseos-rpms 433 k
Enabling module streams:
javapackages-runtime 201801
Transaction Summary
========================================================================================================================================================
Install 11 Packages
Total download size: 119 M
Installed size: 208 M
Is this ok [y/N]: y
Agree to import GPG key when prompted.
Total 2.4 MB/s | 119 MB 00:48
warning: /var/cache/dnf/puppet-caea408efb9b2853/packages/puppet-agent-6.14.0-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID ef8d349f: NOKEY
Puppet Repository el 8 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0xEF8D349F:
Userid : "Puppet, Inc. Release Key (Puppet, Inc. Release Key) <[email protected]>"
Fingerprint: 6F6B 1550 9CF8 E59E 6E46 9F32 7F43 8280 EF8D 349F
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-release
Is this ok [y/N]: y
Confirm package installation:
$ rpm -qi puppetserver
Name : puppetserver
Version : 6.10.0
Release : 1.el8
Architecture: noarch
Install Date: Sat 18 Apr 2020 02:44:33 PM EAT
Group : System Environment/Daemons
Size : 73314128
License : ASL 2.0
Signature : RSA/SHA256, Tue 07 Apr 2020 09:05:06 AM EAT, Key ID 7f438280ef8d349f
Source RPM : puppetserver-6.10.0-1.el8.src.rpm
Build Date : Tue 07 Apr 2020 09:04:04 AM EAT
Build Host : mesos-jenkins-4061cacede444ca0b7c075972400ef86-worker-artifacto
Relocations : /
Packager : Puppet Labs <[email protected]>
Vendor : Puppet Labs <[email protected]>
URL : http://puppet.com
Summary : Puppet Labs puppetserver
....
Step 4: Configure Puppet Master / Server on CentOS 8 / RHEL 8
With the installation of Puppet Master / Server done on CentOS 8, it is time to start configurations.
Define Puppet Master FQDN and DNS alternative names:
$ sudo vim /etc/puppetlabs/puppet/puppet.conf
Add the DNS settings under the [master] section.
dns_alt_names=puppetmaster.example.com,puppetmaster,puppetserver
[main]
certname = puppetmaster.example.com
server = puppetmaster.example.com
environment = production
runinterval = 1h
Where:
- puppetmaster.example.com is the FQDN of your Puppet server.
My configurations look like below after updating:
[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
dns_alt_names=puppetmaster.example.com,puppetmaster,puppetserver
[main]
certname = puppetmaster.example.com
server = puppetmaster.example.com
environment = production
runinterval = 1h
Configure JVM Memory Allocation
The file where you can set min and max memory for JVM is:
$ sudo vim /etc/sysconfig/puppetserver
By default it is set to 2GB. Adjust this depending on resources available on your machine.
JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"
Start Puppet Server on CentOS 8 / RHEL 8
After our basic Puppet Server configuration, start the service and set it to start at system boot.
sudo systemctl enable --now puppetserver
If you had started it earlier, then restart after modifications.
sudo systemctl restart puppetserver
Check service status to confirm it is running.
$ systemctl status puppetserver
● puppetserver.service - puppetserver Service
Loaded: loaded (/usr/lib/systemd/system/puppetserver.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-04-18 14:56:58 EAT; 18s ago
Process: 4068 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS)
Main PID: 4077 (java)
Tasks: 42 (limit: 4915)
Memory: 670.5M
CGroup: /system.slice/puppetserver.service
└─4077 /usr/bin/java -Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger -XX:OnOutOfMemoryError=kill -9 %p -cp />
Open Service Port on the firewall
With the service started, open the port on the firewall so you can access the server from the network.
sudo firewall-cmd --add-service=puppetmaster --permanent
sudo firewall-cmd --reload
Confirm Puppet server is working using Puppet Client on CentOS 8:
$ sudo /opt/puppetlabs/bin/puppet agent --test --ca_server=puppetmaster.example.com
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for puppetmaster.example.com
Info: Applying configuration version '1587211455'
Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
Notice: Applied catalog in 0.01 seconds
Add Puppet Binary folder to $PATH
Puppet binaries are located in /opt/puppetlabs/bin. This directory by default is not in your $PATH. As can be confirmed with:
$ ls /opt/puppetlabs/bin/
facter hiera puppet puppetserver
$ which puppet
/usr/bin/which: no puppet in (/home/vagrant/.local/bin:/home/vagrant/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
Add it to PATH:
$ vim ~/.bashrc
export PATH=$PATH:/opt/puppetlabs/bin
$ source ~/.bashrc
$ which puppet
/opt/puppetlabs/bin/puppet
Our next guide will cover installation of Puppet Agent in your machines to be managed with Puppet. And how you can write basic manifest to install packages, add users, manage Linux services e.t.c.
Similar guides:
Install Ansible on CentOS / RHEL 8
How To Install and Configure Ansible Tower on CentOS 7 / RHEL 7/8