How to install and configure puppet on your machine

Last updated on May 27 2022
Sarika Tak

Table of Contents

How to install and configure puppet on your machine

Puppet – Installation

Puppet works on the client server architecture, wherein we call the server as the Puppet master and the client as the Puppet node. This setup is achieved by installing Puppet on both the client and well as on all the server machines.

For most of the platforms, Puppet can be installed via the package manager of choice. However, for few platforms it can be done by installing the tarball or RubyGems.

Prerequisites

Factor is the only pre-requisite that does not come along with Ohai which is present in Chef.

Standard OS Library

We need to have standard set of library of any underlying OS. Remaining all the system comes along with Ruby 1.8.2 + versions. Following is the list of library items, which an OS should consist of.

  • base64
  • cgi
  • digest/md5
  • etc
  • fileutils
  • ipaddr
  • openssl
  • strscan
  • syslog
  • uri
  • webrick
  • webrick/https
  • xmlrpc

Facter Installation

As discussed, the facter does not come along with the standard edition of Ruby. So, in order to get the facter in the target system one needs to install it manually from the source as the facter library is a pre-requisite of Puppet.

This package is available for multiple platforms however just to be on the safer side it can be installed using tarball, which helps in getting the latest version.

First, download the tarball from the official site of Puppet using the wget utility.

$ wget http://puppetlabs.com/downloads/facter/facter-latest.tgz  ——: 1

Next, un-tar the tar file. Get inside the untarred directory using the CD command. Finally, install the facter using install.rb file present inside the facter directory.

$ gzip -d -c facter-latest.tgz | tar xf – —–: 2

$ cd facter-* ——: 3

$ sudo ruby install.rb # or become root and run install.rb —–:4

Installing Puppet from the Source

First, install the Puppet tarball from the Puppet site using wget. Then, extract the tarball to a target location. Move inside the created directory using the CD command. Using install.rb file, install Puppet on the underlying server.

# get the latest tarball

$ wget http://puppetlabs.com/downloads/puppet/puppet-latest.tgz —–: 1

 

# untar and install it

$ gzip -d -c puppet-latest.tgz | tar xf – —-: 2

$ cd puppet-* ——: 3

$ sudo ruby install.rb # or become root and run install.rb ——-: 4

Installing Puppet and Facter Using Ruby Gem

# Installing Facter

$ wget http://puppetlabs.com/downloads/gems/facter-1.5.7.gem

$ sudo gem install facter-1.5.7.gem

 

# Installing Puppet

$ wget http://puppetlabs.com/downloads/gems/puppet-0.25.1.gem

$ sudo gem install puppet-0.25.1.gem

Puppet – Configuration

Once we have Puppet installed on the system, the next step is to configure it to perform certain initial operations.

Open Firewall Ports on Machines

To make the Puppet server manage the client’s server centrally, one needs to open a specified port on all the machines, i.e. 8140 can be used if it is not in use in any of the machines which we are trying to configure. We need to enable both TCP and UDP communication on all the machines.

Configuration File

The main configuration file for Puppet is etc/puppet/puppet.conf. All the configuration files get created in a package-based configuration of Puppet. Most of the configuration which is required to configure Puppet is kept in these files and once the Puppet run takes place, it picks up those configurations automatically. However, for some specific tasks such as configuring a web server or an external Certificate Authority (CA), Puppet has separate configuration for files and settings.

Server configuration files are located in conf.d directory which is also known as the Puppet master. These files are by default located under /etc/puppetlabs/puppetserver/conf.d path. These config files are in HOCON format, which keeps the basic structure of JSON but it is more readable. When the Puppet startup takes place it picks up all .cong files from conf.d directory and uses them for making any configurational changes. Any changes in these files only takes place when the server is restarted.

List File and Settings File

  • global.conf
  • webserver.conf
  • web-routes.conf
  • puppetserver.conf
  • auth.conf
  • master.conf (deprecated)
  • ca.conf (deprecated)

There are different configuration files in Puppet which are specific to each component in Puppet.

Puppet.conf

Puppet.conf file is Puppet’s main configuration file. Puppet uses the same configuration file to configure all the required Puppet command and services. All Puppet related settings such as the definition of Puppet master, Puppet agent, Puppet apply and certificates are defined in this file. Puppet can refer them as per requirement.

The config file resembles a standard ini file wherein the settings can go into the specific application section of the main section.

Main Config Section

[main]

certname = Test1.vipin.com

server = TestingSrv

environment = production

runinterval = 1h

Puppet Master Config File

[main]

certname = puppetmaster.vipin.com

server = MasterSrv

environment = production

runinterval = 1h

strict_variables = true

[master]

 

dns_alt_names = MasterSrv,brcleprod01.vipin.com,puppet,puppet.test.com

reports = puppetdb

storeconfigs_backend = puppetdb

storeconfigs = true

environment_timeout = unlimited

Detail Overview

In Puppet configuration, the file which is going to be used has multiple configuration sections wherein each section has different kinds of multiple number of settings.

Config Section

Puppet configuration file mainly consists of the following config sections.

  • Main − This is known as the global section which is used by all the commands and services in Puppet. One defines the default values in the main section which can be overridden by any section present in puppet.conf file.
  • Master − This section is referred by Puppet master service and Puppet cert command.
  • Agent − This section is referred by Puppet agent service.
  • User − It is mostly used by Puppet apply command as well as many of the less common commands.

[main]

certname = PuppetTestmaster1.example.com

Key Components of Config File

Following are the key components of Config file.

Comment Lines

In Puppet, any comment line starts with (#) sign. This may intend with any amount of space. We can have a partial comment as well within the same line.

# This is a comment.

Testing = true #this is also a comment in same line

Settings Lines

Settings line must consist of −

  • Any amount of leading space (optional)
  • Name of the settings
  • An equals = to sign, which may be surrounded by any number of space
  • A value for the setting

Setting Variables

In most of the cases, the value of settings will be a single word but in some special cases, there are few special values.

Paths

In configuration file settings, take a list of directories. While defining these directories, one should keep in mind that they should be separated by the system path separator character, which is (:) in *nix platforms and semicolons (;) on Windows.

# *nix version:

environmentpath = $codedir/special_environments:$codedir/environments

# Windows version:

environmentpath = $codedir/environments;C:\ProgramData\PuppetLabs\code\environment

In the definition, the file directory which is listed first is scanned and then later moves to the other directory in the list, if it doesn’t find one.

Files and Directories

All the settings that take a single file or directory can accept an optional hash of permissions. When the server is starting up, Puppet will enforce those files or directories in the list.

ssldir = $vardir/ssl {owner = service, mode = 0771}

In the above code, the allowed hash are owner, group, and mode. There are only two valid values of the owner and group keys.

So, this brings us to the end of blog. This Tecklearn ‘How to install and configure puppet on your machine’ blog helps you with commonly asked questions if you are looking out for a job in DevOps. If you wish to learn Puppet and build a career in DevOps domain, then check out our interactive, Continuous Deployment: Configuration Management using Puppet Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/continuous-deployment-configuration-management-using-puppet/

Continuous Deployment: Configuration Management using Puppet Training

About the Course

Tecklearn has specially designed this Continuous Deployment: Configuration Management using Puppet Training Course to advance your skills for a successful career in this domain. The course will cover different components of Git and GitHub and how they are used in software development operations. The course consists of Configuration Management using Puppet, Puppet Components, important concepts like Puppet Lifecycle, Puppet Language and Puppet Installation. You will get an in-depth knowledge of these concepts and will be able to work on related demos. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Puppet.

Why Should you take Configuration Management using Puppet Training?

  • Average salary of Puppet Professional is $90k – Payscale.com
  • Uber, Salesforce, PayPal, Booking.com, MIT, Starbucks. & many other MNC’s worldwide use Puppet across industries.
  • According to Grand View Research, the DevOps market size is estimated to be worth $12.85 billion by 2025. DevOps professionals are highly paid and in-demand throughout industries including retail, eCommerce, finance, and technology.

What you will Learn in this Course?

Introduction to DevOps

  • What is Software Development
  • Software Development Life Cycle
  • Why DevOps?
  • What is DevOps?
  • DevOps Lifecycle
  • DevOps Tools
  • Benefits of DevOps
  • How DevOps is related to Agile Delivery
  • DevOps Implementation

Continuous Deployment: Configuration Management using Puppet

  • Need of Configuration Management
  • What is Puppet
  • Puppet Architecture
  • Puppet Components
  • Puppet Lifecycle
  • Setting up Master Slave using Puppet
  • Puppet Manifests
  • Puppet Modules
  • Applying configuration using Puppet
  • Puppet File Server
  • Hands On

 

0 responses on "How to install and configure puppet on your machine"

Leave a Message

Your email address will not be published. Required fields are marked *