What is Puppet?

What is Puppet?

Introduction

System administrator attempts to automate repetitive tasks.

Puppet was born to automate repetitive tasks and to give system administrators a flexible framework to build on.

Puppet is written in Ruby, and comprises a configuration language to write manifests and modules, daemons to run the Puppet instructions on managed systems.

Manifests are files containing Puppet code. They are standard text files saved with the .pp extension.

Module is a collection of manifests and data (such as facts, files, and templates), and they have a specific directory structure.

puppet

Puppet Master Server

Puppet uses SSL certificates to authenticate communication between master and agent nodes.

The Puppet master acts as a certificate authority (CA), and must generate its own certificate which is used to sign agent certificate requests.

Below command lists all the signed certificates and unsigned certificate requests

#puppetca –list –all

Client:

  • Puppet agent is required at client side.
  • It communicates with master on port number 8140.
  • Puppet Agent will automatically check for updates from master for every 30min.
  • It is also possible initiate the check manually.

In a particular node we can initiate check by running the following command.

#puppetd  –test

If schedule is configured in the classes or modules then with above command changes will not reflect until the schedule time triggers. To overcome this we need to initiate a below command.

#puppetd –test –ignoreschedule

In puppet master server we can see the important configurations as below

Master servers configuration Files:-

  1. Main Controller configuration file : /etc/puppet/manifests/site.pp
  2. Modules Location :  /etc/puppet/modules
  3. Classes Location : /etc/puppet/manifests/classes
  4. Files server location & config file       : /etc/puppet/files  & /etc/puppet/fileserver.conf
  5. Log file : /var/log/syslog

puppet is controlling services in two ways; they are

  • Module based
  • Class based.

Module Based: – A module is a collection of manifests and data (such as facts, files, and templates), and they have a specific directory structure. Modules are useful for organizing our Puppet code, because they allow us to split our code into multiple manifests. It is considered best practice to use modules to organize almost all of our Puppet manifests.

To add a new module to Puppet, place it in the /etc/puppet/modules directory.

Class Based: – In Puppet, classes are named blocks of Puppet code which are not applied unless they are included / invoked by name. Classes allow us reuse Puppet code, and can make reading manifests easier.

To add a class to Puppet, we need to create a new manifest in the /etc/puppet/manifests/classes directory.

Puppet Terminology: Puppet is a configuration management tool that is extremely powerful in deploying, configuring, managing and maintaining a server machine. Most commonly used terms in puppet are listed below.

  • Module
  • Manifest
  • Class
  • Puppet code
  • Resource

Module: It’s really just a collection of files and directories that can contain Puppet manifests, as well as other objects such as files and templates, all packaged and organized in a way that Puppet can understand and use.

 

Manifest: Manifests are the files that contain Puppet code. These files end with a .pp file extension.

 

Class: Classes are named blocks of Puppet code which are not applied unless they are invoked by name

 

Puppet code: Set of instructions contain commands, keywords, resources & variables which can be processed by puppet engine

 

Resource: Understanding Resources is fundamental to understanding how Puppet works. Resources are like building blocks.

Generally a system consists of files, services, processes, and packages and so on and so on. In the Puppet world, these are called resources. Resources are of a specified type.

 

Resource Type Reference

 

augeas nagios_contact router
computer nagios_contactgroup schedule
cron nagios_host scheduled_task
exec nagios_hostdependency selboolean
file nagios_hostescalation selmodule
filebucket nagios_hostextinfo service
group nagios_hostgroup ssh_authorized_key
host nagios_service sshkey
interface nagios_servicedependency stage
k5login nagios_serviceescalation tidy
macauthorization nagios_serviceextinfo user
mailalias nagios_servicegroup vlan
maillist nagios_timeperiod yumrepo
mcx notify zfs
mount package zone
nagios_command resources zpool

 

The most commonly used resource types are cron, exec, file, package, schedule, service, user, group in classes.

Please go through above links for features, parameters, variables and full-fledged information.