Adopt Puppet for Managing the Configuration of Servers

Prashantha K.P

Introduction:

Today, we cannot imagine the world without computers. All these computers are managed by the system administrators in any given environment. As system administrators need to manage more and more systems, the importance of automation is becoming increasingly obvious.As we all know the system administrator’s role is highly complex, multifaceted and consists of many specialties. It becomes imperative for us to scale these administration diverse tasks. This issue can be easily solved by adopting Puppet for managing the configuration changes. Puppet has been specifically developed to help the sysadmin community gain skills to build and share mature tools that solve the DRY (Don’t Repeat Yourself) problem or the duplication issue.Puppet provides the much needed power and flexibility to the logical group of Infrastructure elements and allow them to self-heal any problem that arises from time to time. Many companies have already adopted puppet and realized its capabilities in achieving the desired state of Infrastructure.It helps in configuring, discovering and managing the infrastructure and also enables Dev-ops to work faster and smarter.Puppet is highly responsive to business needs as it eliminates the configuration drift that happens over a period of time. Puppet provides clear visibility in to the changes done over time and it also makes it easy for us to rollback changes by having checkpoints.

We have sketched through the table below the operating systems on which Puppet Enterprisecan be installed.

Operating System

Version

Architecture

Red Hat Enterprise Linux

6, 7

x86_64

CentOS

6, 7

x86_64

Oracle Linux

6, 7

x86_64

Scientific Linux

6, 7

x86_64

Ubuntu

12.04, 14.04

x86_64

SUSE Linux Enterprise Server

11, 12

x86_64

Step by Step procedure for Puppet Installation:
Puppet Agent Can be installed on most of the operating systems which are currently active in the market. This paper clearly explains the details of theinitial setup of Master and Agent using CentOS.

Here we shall go through the complete set of Instructions one by one with relevant diagrams and screen shots. Screen shots given make procedure crystal clear. This should make it child’s play for you to install puppet Enterprise on CentOS. We have two hosts for our experiment

  • Master.wiprott.com
  • Agent.wiprott.com

Configuring the Master:

First we will see the operations to be executed on the Master machine. Then we will see the operations to be run on the slave machine. Here are the instructions to be executed on the master machine.

  • Download and Extract the package puppet-enterprise-3.7.2-el-7-x86_64.tar.gz
  • Then do -># tar –zxvfpuppet-enterprise-3.7.2-el-7-x86_64.tar.gz
  • # cd puppet-enterprise-3.7.2-el-7-x86_64

For the installation to be successful we have to provide the access to standard package repo to install all the supporting packages.

root@mymaster puppet-enterprise-3.7.2-el-7-x86_64]# ./puppet-enterprise-installer

As you can see you get the “welcome” page for Puppet Enterprise Installer. In the subsequent pages that appear,you need to provide the input on deployment type, database support and user details. If your machine already has the PostgreSQL, then you can use the same database or you can select one for the fresh installation. The installation logs that are shown here are instant and verbose.

We have to select the deployment type required from the choices that appear on the below screen. This page is about your infrastructure current scale or projected scale in near future or long run.

We need to provide the database and server host details in the windows that appears below.


Puppet Enterprise Console:

The Enterprise console provides the graphical interface to perform different tasks such as Role Based access control, Node Management, Node classification based on name, Architecture, geographic location or IP Address. We can see all the logs generated against individual Nodes using this interface.

The desired state and any changes can be observed using this interface.

Here is the Login Page for Puppet Enterprise Console

Once you have logged in to the page you can see all the nodes connected to the master.

Once the puppet Enterprise is installed we can check if the installation is successful by using command below.
puppet resource service pe-puppetserver. service ensure=running

If there aresome problems in getting the Puppet Enterprise console we need to try the below mentioned commands in sequence.

systemctl restart pe-puppet
systemctlrestart pe-puppetserver.service
systemctl restart pe-postgresql
systemctl restart pe-console-services

Configuring the Agent:

Check the connectivity between Master and Agent machines and then execute the below command
# curl –k https://<Mastermachine’s IP or Hostname> : 8140/packages/current/install.bash | sudo bash
We can check the puppet agent service using the command below

# puppet resource service pe-puppet ensure=running

Once the agent is installed you have to sign the SSL certificate for the agent from the Puppet Master machine

# puppet cert sign agent.wiprott.com

Let us see what happens when we type the following commands from the Agent machine. This will provide us the latest catalog details from the Master. This action will be performed by the master automatically once every 30 minutes (this can also be configured) or otherwise. One can also apply this to see the result instantly. It is wise to a give bigger time interval as the number of nodes increase.

# puppet agent -t

Now we can see that the initial setup for the Master and Agent is ready and you can start working on it. The manifests creation to achieve the desired state is very important aspect and the administrators have to think in the programmer’s frame of mind to come out with the best code. The detailed manifest creation and remotely applying the catalogs from Master will be discussed in the next paper.

We shall write one sample puppet script in Master machine and check the output in Agent. In the master machine let us add the code in site.pp file to create the user in the node agent.wiprott.com

Let us begin doing this as shown in the window below.

Let us apply that in node agent.wiprott.com and check the result. Here agent will send the factor details to master and then master creates the catalog for the agent. Once the agent receives the catalog it has to work on the instructions passed by master and get up to date with desired state.

In the above example we have used a pretty simple way of demonstrating the master agent communication with the simple manifest code. In the subsequent article we will provide detailed information on how to write and apply the manifests.

About the Author:

Prashantha K.P is a Lead Consultant and working in Talent Transformation, Wipro Technologies, Bangalore. He can be reached at: prashantha.krishna@wipro.com








}