Automation using Puppet and Jenkins

F
Flentas Tech 3rd May 2022 - 4 mins read

In our previous blog post, we have explained Automation using Chef and Jenkins. This blog post talks about Automation using Puppet and Jenkins, which are generally used to fetch the status of the app servers before the actual deployment.

Puppet Architecture

Puppet is a pull-based automation tool and an end-to-end configuration management tool that communicates via SSL encrypted connection between the server and client. Puppetarchitecture mainly consistsof a Puppet server and Puppet client. When we run a configuration in the Puppet server, we can deploy that configuration to multiple Puppet agent servers.

Puppet server Includes:-

  • Modules
  • Hiera
  • Puppet DB

Puppet client Includes:-

  • Puppet Agent

    Modules are used for end-to-end configuration to specify all things the agent server has to deploy.

    The Puppet server is the place where we store manifests and the modules. Manifests are the end state server description.

    Hiera is the key-value store that we can feed into the module later. It contains the catalog, which is the mapping of the manifests.

How does it work?

The Puppet agent collects the information of the Puppet agent itself and sends that to the Puppet server. Then it requests a catalog that specifies which module needs to implement on which server. When the catalog is received, the agent ensures the server is in the matching state particularized in the catalog. After implementing the modules in the agent server, it sends back a report to the Puppet server that describes all the applied settings.

Puppet DB

It is a PostgreSQL database that collects additional data-consuming Puppet setup and any of the running Puppet nodes. It is available in both Puppet open source edition and Puppet enterprise edition.
However, the Puppet enterprise edition is featured more than the Puppet open source edition.

DB usually fetches the matrix about the nodes running the Puppet agent in the Puppet. Using this Puppet DB, we can store the reports about the deployment of the modules and the manifests and the configurations applied to the node.

Jenkins architecture

Jenkins is a continuous integration (CI) server which allows developers to update a repo multiple times a day with various developers, solving the problem of having different copies of the same source code. You can build software with each commit to the code, quickly identifying bugs using a continuous integration server. Jenkins has an extensive range of plugins, and thus the need to build software manually is reduced. Custom build rules and dependencies can be set in Jenkins as it is a highly configurable tool.

The single Jenkins server is not enough to meet specific requirements, and hence Jenkins distributed architecture is used to meet these needs.

Jenkins distributed architecture

Jenkins uses master-slave architecture to manage distributed builds. Master and slave communicate through TCP/IP protocol.

Jenkins master

The main Jenkins server is the master. The job of the master is to schedule build jobs, dispatch builds to the slaves for actual execution, monitor the slaves, and record and build slave results.

Jenkins slave

Slave is a java executable that runs on a local machine. The primary function of a slave is to execute build jobs dispatched by the master. Characteristics of Jenkins slaves are: It hears requests from Jenkins master instance and can run on any operating system.

Jenkins build pipeline

It is used to know which task Jenkins is currently executing. Builds are broken into sections in the build pipeline, such as units and acceptance tests, packaging, reporting, and deployment phases.

Integration of Puppet with Jenkins

We can integrate the Puppet server with the Jenkins server using the Puppet plugin and download the reports about the configuration changes in the nodes running the Puppet. There are mainly two options available for integrating Puppet with Jenkins, one using the API Token, which is available only on the enterprise edition. We have to integrate the open-source Puppet via SSH connectivity.

To Summarize

  • Puppet is a configuration management tool.
  • Puppet is available in two editions, open-source and enterprise(featured)
  • Integration and the report transfer between the Puppet and Jenkins, done through RABC API Token in enterprise edition. Need to use SSH communication in open source edition
  • Puppet is a pull-based automation tool. By default, the Puppet agent will request the catalog to the Puppet server every 30 minutes
  • Puppetenterprise edition costs $112 per node/year
  • Puppet DB is the report store of the Puppet server. It contains the details about the configuration status of all nodes
  • Jenkins can retrieve the reports from the Puppet server via SSH in the open source edition and via RABC API Token in the enterprise edition

Advantages

  • It applies the configuration to the N number of nodes and quickly sends reports to the server.
  • It is available in open source.
  • Puppet will implement the changes only when it is needed
  • Jenkins integration plugin is available for fetching the reports

Disadvantages

  • The Enterprise edition is more featured than the open-source edition
  • UI is available for the enterprise edition and needs to create manually in an open-source edition which is not recommended in production
  • API token authentication is only available in the Enterprise edition, and it needs to configure SSH authentication for the Jenkins integration
  • Every command would work in open source. Enterprise edition is incorporated with all the available command-line tools

Top Blog Posts

×

Talk to our experts:

Talk to our experts to discuss your requirements

Real boy icon sized sample pic  Real girl icon sized sample pic Real boy icon sized sample pic
India Directory