Puppet

Puppet is Article description::a configuration management system written in [[Ruby.]] It can be used for automating machine deployments.

Installation
Currently, there is no distinction between server and client, so the basic installation procedure is the same for both.

Emerge
Install :

Configuration and setup
Puppet is mainly configured through in an INI-style format. Comments are marked with a hash sign.

The configuration file is separated into several sections, or blocks:


 * contains settings that act as a default for all parts of Puppet, unless overridden by settings in any of the following sections:
 * is used for settings applying to the Puppetmaster, or CA tool
 * is used for settings applying to the Puppet agent

A more in-depth explanation, as well as a list of further blocks used is available in the official Puppet documentation. Also, there is a list of all configuration options, some of which of course make only sense when applied to either server or client.

Server (Puppetmaster) setup
The default configuration put by the ebuild into can be used as-is. For Puppet 2.7.3, the server-related parts look like this:

Setting up the file server
To be able to send files to the clients, the file server has to be configured. This is done in. By default, there are no files being served.

The snippet above sets up a share called files (remember this identifier, as it will need to be referenced later), looking for files in and only available for hosts with an IP from the 192.168.0.0/24 network. Any of the IP addresses, CIDR notation, and host names (including wildcards like ) can be used here. The deny command can be used to explicitly deny access to certain hosts or IP ranges.

Starting the puppetmaster daemon
With the basic configuration as well as an initial file server configuration, we can start the Puppetmaster daemon using its OpenRC init script:

During the first start, Puppet generates an SSL certificate for the Puppetmaster host and places it into the directory configured through the ssldir variable, as configured above.

It listens on Port, make sure that there are no firewall rules obstructing access from the clients.

A simple manifest
Manifests, in Puppet's terminology, are the files in which the client configuration is specified. The documentation contains a comprehensive guide about the manifest markup language.

As a simple example, let's create a message of the day (motd) file on the client. On the puppetmaster, create a file inside the files share created earlier:

Then, we have to create the main manifest file in the directory. It is called site.pp:

The default node (the name for a client) definition is used in case there is no specific node statement for the host. We use a file resource and want the file on our clients to contain the same thing as the motd file in the files</tt> share on the host. If the puppetmaster is only reachable using another host name, adapt the source</tt> URI accordingly.

Client configuration
During the first execution of the Puppet agent, wait for the certificate to be signed by the puppetmaster. To request a certificate, and execute the first configuration run, execute:

Before the client can connect, authorize the certificate request on the server. The client should appear in the list of nodes requesting a certificate:

Now, we grant the request:

The client will check every 60 seconds whether its certificate has already been issued. After that, it continues with the first configuration run:

When this message pops up, all went well. Now check the contents of the file on the client:

OpenRC
Start the puppet agent as a deamon and have it launch on boot:

Systemd
Conversely, when running systemd:

Manually generating certificates
To manually generate a certificate, use the utility. It will place all generated certificates into the ssldir defined directory as set in the puppet configuration and will sign them with the key of the local Puppet Certificate Authority (CA).

An easy case is the generation of a certificate with only one Common Name:

If the certificate has to be valid for multiple host names, use the  parameter and separate the additional host names with a colon:

This example will generate a certificate valid for the three listed host names.

Refreshing agent certificates
This is the process used to manually refresh agent certificates.


 * 1) (on master)
 * 2) (on agent)
 * 3) * This will cause the Puppet agent to regenerate the CSR with the existing SSL key.
 * 4) * The old certificate is no longer valid, as it was nuked on the master.
 * 5) * When one of the above steps is forgotten, an error will pop up about the certificate mis-matching between agent and master.
 * 6) * To replace the SSL keys (optional):
 * 7) (on agent)
 * 8) * When using auto-signing, no further steps are needed.
 * 9) (on master)
 * 10) Verify that the fingerprint listed in the previous two outputs matches
 * 11) (on master)
 * 12) (on agent)

Managing slots with puppet
While the default portage provider in puppet does support slots there are puppet modules available which also have this functionality.

For instance, with version 4.6.0 and higher, and/or, the slot functionality is supported like to:

Additional modules are:
 * puppet-portage
 * PortageGT

External resources

 * Upstream website
 * Puppet Wiki