puppet-agent - Man Page

The puppet agent daemon

Examples (TL;DR)

Synopsis

Retrieves the client configuration from the Puppet master and applies it to the local host.

This service may be run as a daemon, run periodically using cron (or something similar), or run interactively for testing purposes.

Usage

puppet agent [--certname NAME] [-D|--daemonize|--no-daemonize] [-d|--debug] [--detailed-exitcodes] [--digest DIGEST] [--disable [MESSAGE]] [--enable] [--fingerprint] [-h|--help] [-l|--logdest syslog|eventlog|ABS FILEPATH|console] [--serverport PORT] [--noop] [-o|--onetime] [--sourceaddress IP_ADDRESS] [-t|--test] [-v|--verbose] [-V|--version] [-w|--waitforcert SECONDS]

Description

This is the main puppet client. Its job is to retrieve the local machine´s configuration from a remote server and apply it. In order to successfully communicate with the remote server, the client must have a certificate signed by a certificate authority that the server trusts; the recommended method for this, at the moment, is to run a certificate authority as part of the puppet server (which is the default). The client will connect and request a signed certificate, and will continue connecting until it receives one.

Once the client has a signed certificate, it will retrieve its configuration and apply it.

Usage Notes

´puppet agent´ does its best to find a compromise between interactive use and daemon use. If you run it with no arguments and no configuration, it goes into the background, attempts to get a signed certificate, and retrieves and applies its configuration every 30 minutes.

Some flags are meant specifically for interactive use --- in particular, ´test´, ´tags´ and ´fingerprint´ are useful.

´--test´ runs once in the foreground with verbose logging, then exits. It also exits if it can´t get a valid catalog. --test includes the ´--detailed-exitcodes´ option by default and exits with one of the following exit codes:

´--tags´ allows you to specify what portions of a configuration you want to apply. Puppet elements are tagged with all of the class or definition names that contain them, and you can use the ´tags´ flag to specify one of these names, causing only configuration elements contained within that class or definition to be applied. This is very useful when you are testing new configurations --- for instance, if you are just starting to manage ´ntpd´, you would put all of the new elements into an ´ntpd´ class, and call puppet with ´--tags ntpd´, which would only apply that small portion of the configuration during your testing, rather than applying the whole thing.

´--fingerprint´ is a one-time flag. In this mode ´puppet agent´ runs once and displays on the console (and in the log) the current certificate (or certificate request) fingerprint. Providing the ´--digest´ option allows you to use a different digest algorithm to generate the fingerprint. The main use is to verify that before signing a certificate request on the master, the certificate request the master received is the same as the one the client sent (to prevent against man-in-the-middle attacks when signing certificates).

´--skip_tags´ is a flag used to filter resources. If this is set, then only resources not tagged with the specified tags will be applied. Values must be comma-separated.

Options

Note that any Puppet setting that´s valid in the configuration file is also a valid long argument. For example, ´server´ is a valid setting, so you can specify ´--server servername´ as an argument. Boolean settings accept a ´--no-´ prefix to turn off a behavior, translating into ´--setting´ and ´--no-setting´ pairs, such as --daemonize and --no-daemonize.

See the configuration file documentation at https://puppet.com/docs/puppet/latest/configuration.html for the full list of acceptable settings. A commented list of all settings can also be generated by running puppet agent with ´--genconfig´.

Example

$ puppet agent --server puppet.domain.com

Diagnostics

Puppet agent accepts the following signals:

SIGHUP

Restart the puppet agent daemon.

SIGINT and SIGTERM

Shut down the puppet agent daemon.

SIGUSR1

Immediately retrieve and apply configurations from the puppet master.

SIGUSR2

Close file descriptors for log files and reopen them. Used with logrotate.

Author

Luke Kanies

Info

February 2024 Puppet, Inc. Puppet manual