Getting Started and Working with Puppet 4 On RHEL 7 and CentOS 7

Puppet is a Systems Configuration Management/Systems Automation framework written in Ruby that allows system administrators to programmatically provision, configure, and manage servers, network devices, and storage, in a data center or in the cloud. Puppet 4 On RHEL 7 and CentOS 7 makes it easy to create customized system configurations and perform ongoing management of machines by using a set of modules.

Why Configuration Management?

Reproducable setups: Do once and repeat many times

Scaling: Easy to scale to many machines, done for one but use on many

Coherent and consistent server setups

Visibility : Visibility into the changes occurring in your infra over time and impact on service levels.

Manifests

Files ending with .pp extension. A manifest defines each required resource using a set of key-valuepairs for their attributes.

Classes

These are collection of related resources that once defined, can be declared as a single unit. A class may describe everything needed to configure an entire application or service. For example, a class can contain all of the resources (such as files, settings, modules, and scripts) needed to configure the Apache webserver on a host.

Modules

A module is a collection of classes, resource types, files, functions and templates, organized around a particular purpose. For example, a module can configure an Apache webserver instance or Rails application.

My Lab setup

For this Puppet 4 On RHEL 7 and CentOS 7 setup, my deployment type is Agent/Master puppet – This setup requires a central puppet master server/s to host and compile all configuration data. The other nodes run the puppet agent service which will periodically pull its configurations from the master. The puppet master service has to be kept available and responsive.

My Lab setup is a two node, master and client with below settings :

Puppet Master

IP Addess

192.168.10.10

Hostname

master.example.com

Puppet Client

IP Addess

192.168.10.11

Hostname

client.example.com

Installing Puppet server

The newest version of Puppet can be installed from the yum.puppetlabs.com package repository. On your RHEL 7 or Centos 7, just execute commands below to add repo and do the installation.

By using this added repo, version 4.x of Puppet will be installed. In Puppet 4, a lot of important config files and directories were changed. Review table below for essential directories and files to take note of.

Directory

Explanatiom

/opt/puppetlabs/bin

Puppet server binaries reside here

/opt/puppetlabs/puppet/bin/

Directory for private binaries

/opt/puppetlabs/server

Where the server-side apps live underneath

/etc/puppetlabs/

Puppet’s system confdir; used by root and the puppet user. Contains code, mcollective, puppet, puppetserver and pxp-agent directories.

For the version of Puppet installed here version 4.x, the main executables moved to /opt/puppetlabs/bin. This means all the puppet and related tools aren’t included in your PATH by default. Therefore, we’ll have to create symbolic links to make them system-wide available:

Every node must have a unique hostname. Forward and reverse DNS must both be configured correctly. If you don’t have DNS server in your setup environment, consider adding hostname and IP values to /etc/hosts file on each node. On my setup, I’ll add as below

Also set the dns_alt_names which are a comma-separated list of alternate DNS names for Puppet Server. These are extra hostnames the server is allowed to use when serving agents.They are added in the [master] section of the master’s puppet.conf file.

Testing

So far we’ve installed both puppet master and client nodes. Let’s do some testing on our Puppet 4 On RHEL 7 and CentOS 7 setup to confirm everything works as expected. We’ll create simple test manifest and apply it to the client node. The manifest is to create a user named bob, with uid of 1000 and is a member of wheel group:

Conclusion

On this blog post- working with Puppet 4 On RHEL 7 and CentOS 7, we’ve been able to successfully install and configure both the puppet master and Puppet v4 client. To this end, you should be ready to start learning and practicing with puppet 4. On our next Puppet tutorial, we’ll explore Puppet Resources, Classes, Advanced Manifests and how to write custom Puppet modules. Till then, stay tuned by following me on Twitter.