Run Puppet agent as a cron job
Run Puppet agent as a cron job when running as a non-root user.
If the onetime
setting is set to true
, the Puppet agent
command does one configuration run and then quits. If the daemonize
setting is set
to false
,
the command stays in the foreground until the run is finished. If set
to true
, it
does the run in the background.
This behavior is good for
building a cron job that does configuration runs. You can use the splay
and splaylimit
settings to keep the primaryPuppet server from getting overwhelmed, because the
system time is probably synchronized across all of your agent nodes.
To set up a cron job, run the puppet resource
command:
sudo puppet resource cron puppet-agent ensure=present user=root minute=30 command='/opt/puppetlabs/bin/puppet agent --onetime --no-daemonize --splay --splaylimit 60'The above example runs Puppet one time every hour.