Just learned this tip yesterday, /etc/sysconfig/puppet is the file what allows you to include extra options in the Puppet client daemon. The extra options are automatically attached to the puppet daemon whenever you start the Puppet service – ‘service puppet start’.
The trick is in the file /etc/init.d/puppet.
start() {
echo -n $”Starting puppet agent: ”
daemon $daemonopts $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
For example, I want Puppet on some servers to send logs to a particular files e.g. /mylog/puppet. I can enable it by keeping the following line in /etc/sysconfig/puppet.
PUPPET_EXTRA_OPTS=–logdest /mylog/puppet
When Puppet client runs, it will be ‘usr/bin/ruby /usr/bin/puppet agent –logdest /mylog/puppet ‘ in the daemon.
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 translate into
‘–setting’ and ‘–no-setting’ pairs.
See the configuration file documentation at
http://docs.puppetlabs.com/references/stable/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’.
* –certname:
Set the certname (unique ID) of the client. The master reads this
unique identifying string, which is usually set to the node’s
fully-qualified domain name, to determine which configurations the
node will receive. Use this option to debug setup problems or
implement unusual node identification schemes.
(This is a Puppet setting, and can go in puppet.conf.)
* –daemonize:
Send the process into the background. This is the default.
(This is a Puppet setting, and can go in puppet.conf. Note the special ‘no-‘
prefix for boolean settings on the command line.)
* –no-daemonize:
Do not send the process into the background.
(This is a Puppet setting, and can go in puppet.conf. Note the special ‘no-‘
prefix for boolean settings on the command line.)
* –debug:
Enable full debugging.
* –detailed-exitcodes:
Provide transaction information via exit codes. If this is enabled, an exit
code of ‘2’ means there were changes, an exit code of ‘4’ means there were
failures during the transaction, and an exit code of ‘6’ means there were both
changes and failures.
* –digest:
Change the certificate fingerprinting digest algorithm. The default is
SHA256. Valid values depends on the version of OpenSSL installed, but
will likely contain MD5, MD2, SHA1 and SHA256.
* –disable:
Disable working on the local system. This puts a lock file in place,
causing ‘puppet agent’ not to work on the system until the lock file
is removed. This is useful if you are testing a configuration and do
not want the central configuration to override the local state until
everything is tested and committed.
Disable can also take an optional message that will be reported by the
‘puppet agent’ at the next disabled run.
‘puppet agent’ uses the same lock file while it is running, so no more
than one ‘puppet agent’ process is working at a time.
‘puppet agent’ exits after executing this.
* –enable:
Enable working on the local system. This removes any lock file,
causing ‘puppet agent’ to start managing the local system again
(although it will continue to use its normal scheduling, so it might
not start for another half hour).
‘puppet agent’ exits after executing this.
* –fingerprint:
Display the current certificate or certificate signing request
fingerprint and then exit. Use the ‘–digest’ option to change the
digest algorithm used.
* –help:
Print this help message
* –logdest:
Where to send messages. Choose between syslog, the console, and a log
file. Defaults to sending messages to syslog, or the console if
debugging or verbosity is enabled.
* –masterport:
The port on which to contact the puppet master.
(This is a Puppet setting, and can go in puppet.conf.)
* –no-client:
Do not create a config client. This will cause the daemon to start
but not check configuration unless it is triggered with `puppet
kick`. This only makes sense when puppet agent is being run with
listen = true in puppet.conf or was started with the `–listen` option.
* –noop:
Use ‘noop’ mode where the daemon runs in a no-op or dry-run mode. This
is useful for seeing what changes Puppet will make without actually
executing the changes.
(This is a Puppet setting, and can go in puppet.conf. Note the special ‘no-‘
prefix for boolean settings on the command line.)
* –onetime:
Run the configuration once. Runs a single (normally daemonized) Puppet
run. Useful for interactively running puppet agent when used in
conjunction with the –no-daemonize option.
(This is a Puppet setting, and can go in puppet.conf. Note the special ‘no-‘
prefix for boolean settings on the command line.)
* –test:
Enable the most common options used for testing. These are ‘onetime’,
‘verbose’, ‘ignorecache’, ‘no-daemonize’, ‘no-usecacheonfailure’,
‘detailed-exitcodes’, ‘no-splay’, and ‘show_diff’.
* –verbose:
Turn on verbose reporting.
* –version:
Print the puppet version number and exit.
* –waitforcert:
This option only matters for daemons that do not yet have certificates
and it is enabled by default, with a value of 120 (seconds). This
causes ‘puppet agent’ to connect to the server every 2 minutes and ask
it to sign a certificate request. This is useful for the initial setup
of a puppet client. You can turn off waiting for certificates by
specifying a time of 0.
(This is a Puppet setting, and can go in puppet.conf. Note the special ‘no-‘
prefix for boolean settings on the command line.)