Puppet (5.5)

Puppet is a open source software used in configuration automation platform , which simplifies system administrator’s work by managing multiple servers through a single server. It is a master-client model where the server is the master and agent is the client.

Installation steps:

Pre-installation steps:

1. Edit host file
Vi /etc/hosts
In master: puppetmaster.unixadmin.in puppetmaster
In client: puppetagent.unixadmin.in puppetagent puppetmaster.unixadmin.in puppetmaster

2. Disable SELINUX :
Vi /etc/selinux/config
SELINUX = Disable (change enforcing to disable)

3. Stop firewalld and Network Manager
Systemctl stop firewalld
Systemctl stop NetworkManager

4. Install and configure NTP service.
yum -y install ntp ntpdate
systemctl start ntpd
systemctl enable ntpd
ntpdate 0.centos.pool.ntp.org

Installation steps :

Puppet server:

1. Install puppet server : In order to install the puppet server we first need to set up the dependent repository to install the puppet server i.e.
# rpm -Uvh https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm

Then , install the puppet server using the command

# yum -y install puppetserver

2. Edit puppet server configuration :
Edit the puppet configuration file
vi /etc/puppetlabs/puppet/puppet.conf
and add the following lines


certname = puppet.unixadmin.in
server = puppet.unixadmin.in
environment = production
runinterval = 1h

then, save and exit.

3. Start the puppet service:
# systemctl start puppetserver
# systemctl enable puppetserver

Puppet agent:

1. Install puppet agent:
The puppet repository needs to be downloaded first same as puppet master in order to install the puppet agent.
# rpm -Uvh https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm
Then, install puppet agent using the command
# yum install -y puppet-agent.

2. Edit puppet agent configuration:
To configure client (agent) edit the puppet configuration file.
Vi /etc/puppetlabs/puppet/puppet.conf
Add the following lines.

certname = puppetclient.unixadmin.in
server = puppet.unixadmin.in
environment = production
runinterval = 1h

then save and exit.

3. Start the agent service:
Systemctl start puppet
Systemctl enable puppet

Puppet master and agent configuration :

On master :
To check if there are any signing request run the following command
/opt/puppetlabs/bin/puppet cert list
It displays the certificate signing request of the agent (client) as,
Then, to sign the client certificate run,
/opt/puppetlabs/bin/puppet cert sign puppetclient.unixadmin.in

On agent :

After signing certificate on the master side , master and agent will now be able to communicate .
Then, to check the puppet agent’s output if any changes have been made to the configuration file in the master , manually we can verify it by running the command.
/opt/puppetlabs/bin/puppet agent –test.
Then, all the changes gets immediately applied to the agent.

Puppet manifests examples:

1. Installing a package:
To install any package on the agent side from master, we need to change the configuration file in the master side. for ex: here we are installing httpd package from master on to the agent using the following command.
cd /etc/puppetlabs/code/environments/production/manifests/
In the above path create a file site.pp by adding following lines in it.
Vi site.pp
Node ‘puppetclient.unixadmin.in’{
Package {‘httpd’:
Ensure => “installed”,
Service {‘httpd’:
Ensure => running,
Enable=> true,

Then , on the agent side we can test whether changes made on the master have been applied (i.e whether httpd is installed ) using the command.
/opt/puppetlabs/bin/puppet agent –test

2. Adding host entry and to stop firewalld service :
To add the host entry in the agent add the following lines in site.pp configuration file of the master.
cd /etc/puppetlabs/code/environments/production/manifests/
vi site.pp

Node ‘puppetclient.unixadmin.in’{

host { '/etc/hosts':
name => 'pulp1.unixadmin.in',
      # (namevar) The host…
ensure => 'present',                     # The basic property that the resource should be…
comment =>'test server',                # A comment that will be attached to the line with
host_aliases => 'pulp1',                # Any aliases the host might have. Multiple…
ip => '',                        # The host’s IP address, IPv4 or…
provider => 'parsed',                       # The specific backend to use for this `host…
target => '/etc/hosts',                  # The file in which to store service information.
# …plus any applicable metaparameters.
service { 'firewalld':
ensure => stopped,
enable => false,

Then , on the agent side run the below command to apply the changes made on the master.
/opt/puppetlabs/bin/puppet agent –test.
And hence host name will be added as pulp1.unixadmin.in pulp1 # test server
And the firewalld service will be stopped even after boot.

Be the first to comment on "Puppet (5.5)"

Leave a comment

Your email address will not be published.