What is a Puppet in DevOps?

by StarAgile

August 17, 2020
Category DevOps


What is a Puppet in DevOps

DevOps life cycle has many tools to work with and provides many advantages such as error-free, faster life cycle, configuration management, greater management of the SDLC, less iterative, provides saving in cost, savings in time, continuous integration and continuous deployment, etc. The tools in DevOps include the following,

  • Artifact Managing tools  - NPM, Nexus, JFrog Artifactory
  • Build tools - Ant, Maven, Gradle, MS Build
  • Cloud Services - Azure, AWS, OpenShift, Cloud foundry, and GCP
  • Configuration Management tools - Ansible, puppet, chef
  • Continuous integration tools-  Jenkins, TeamCity, Bamboo, CircleCI
  • Database Management Tools  - MySQL, MongoDB, Liquidbase
  • Deployment tools - Juju, XLDeploy, Octopus Deploy
  • Monitoring Tools - Prometheus, Nagios, Google Analytics, Logstash
  • Orchestration tools - Kubernetes, Nomad, Docker
  • Testing Tool - Selenium, SonarQube, Pytest, Katalon

What is Configuration Management?

Configuration management is the process of maintaining and establishing the performance of the products by maintaining its physical attributes, functional attributes, design, requirements, and operational information throughout its life cycle. 

The system administrators who will manually install, deploy, and configure a variety of servers and devices for the applications to run, this is a repetitive task, highly complex, and prone to errors. 

In this scenario, we need to automate the process of configuring a variety of servers and devices and thus make the system's configuration faster, less error-prone, and to do it easily with some simple methods.

Now you may be curious about what tool to use for this scenario. As you see there are tools such as 

They are the tools for configuration management of systems and are used extensively in the DevOps environment. 

In this article, we will be talking about the configuration management DevOps tool – which is “Puppet”.

What is Puppet in DevOps

The puppet is a system management tool that helps in automating and centralizing the configuration management process. It also used for software deployment. It is available in open source and commercial versions.

It helps in servers’ configuration management, servers’ deployments, and orchestrations of various applications across a whole lot of infrastructure in the organization.

Imagine you have 100 servers, it is not possible to maintain, manage and configure the servers manually, Puppet performs the following,

  • Puppet allows us to do separate configurations for every host
  • It continuously monitors the server for the configurations and if the configurations are altered it automatically changes to a pre-defined configuration on the hosts.
  • It has control over a whole lot of infrastructure so that the centralized configurations get effected in each of the infrastructures
  • It is also used as an automatic deployment tool for all the applications on the servers. 
  • It implements Infrastructure as a Code, the policies and configurations are written as a code.

Explain the Working of Puppet 

Puppet uses the declarative Domain Specific Language (DSL) to define the configuration attributes to the infrastructure or specific environment. It uses a utility called facter to find the information about the systems. The puppet master uses the system called manifests to control and manage the nodes with the configuration information. The nodes are nothing but servers or infrastructure which have puppet agent or daemon install in them and the puppet master controls the nodes.

The configuration information of each node is collected by the puppet agent and sent to the puppet master. The puppet master then compiles the catalog on how each node must be configured. Now each node applies the configuration and updates itself. Puppet agent works using the pull service regularly by pulling the information from the puppet master on the site-specific configuration and the node-specific configuration. The puppet agent is typically run in the background of the nodes.

There are 5 steps, on which the infrastructure is managed and controlled by Puppet Master and Puppet agents,

  1. The node running the puppet agents uses the pull information and polls the master. The node collects information about itself using the facts.
  2. These facts are sent to the puppet master by the agent
  3. The puppet master compiles a catalog on how the node must be configured
  4. The Master sends the catalog to the agent.
  5. The agent configures itself and reports back to the master.

The puppet master is a daemon that runs on a server designated to itself. The master sends the configuration details to the agents. The puppet master keeps all information on the entire infrastructure it controls as nodes.

The puppet master also does the following,

  • Complies the catalog for the agents
  • Sends reports to the central instance or the server.
  • Transfers files to the file servers

The puppet agent runs on the nodes and collects the facts for the master. After receiving the catalog from the master by polling the master, it updates itself. The agent gains the communication privileges from the master by requesting a Secure Socket Layer (SSL) certificate for the first time. The agent then polls the master for the configuration updates. This is completed as long as the SSL certificate is valid. The puppet agent must have the required privileges to configure the nodes and is usually run as a root user or the user who has been assigned the puppet management rights profile.

The puppet user and group are used to get the information from the module securely only the information that the puppet master requires.

Through the puppet user, the puppet master performs the following activities, such as

  • Creates catalogs,
  • Accepts SSL certificate from the agent
  • Store configuration manifests in the puppet manifests directory
  • Transfer files to the agents

Puppet encryption and communication is done by having the SSL/TLS protocols. This is done to encrypt the traffic between the nodes and the master. SHA-256 is the hash used as a default.

The following things are done,

  • Authenticates any agent on the master
  • Authenticates any master on any agent
  • Prevents eavesdropping on the master and agent communication

Why Puppet Software for DevOps – Top 5 Benefits

  1. Eliminates time consuming, complex and stressful manual configurations of the infrastructure
  2. Automates the process of configurations, controlling and managing large numbers (over 100 servers) of servers and other infrastructure
  3. Eliminates complex error-prone tasks of automating the infrastructure deployment and configuration
  4. It is an inexpensive method of solving the configurations bottlenecks and latency in the speed
  5. Puppet is used as a continuous delivery model to the software release cycle by automating the operations and deployment workflow

How to Install Puppet Automation Tool – Step by Step Instruction

  • First choose on the deployment types, such as the client-server model. Puppet uses master and agents as client-servers model
  • Second, select the server for the puppet master. The puppet master must be installed on the server before the agents are installed. Any Unix or Linux server can be used for installing the puppet master. The windows machine will not work.
  • Third check the OS versions and system requirements as the puppet must handle a lot of heavy traffics.
  • Fourth open the firewall for the master-agent communication such as the port 8140 must be unused and open for the puppet. Every node must have a unique hostname. The forward and reverse DNS must be correctly configured.
  • Fifth, the time must be configured for the puppet master by using the NTP module to connect with the NTP server.
  • Finally, the agents must be installed on the nodes which the puppet master connects.

Concluding note

You have seen in brief about how Puppet DevOps works and how the puppet automation consists of large benefits to the system design, operations, and system configurations. 

If you want to use puppet effectively in your DevOps projects, then you need DevOps training offered by StarAgile.