8

Aim

The aim is to disable automatic Puppet-agent runs that occur every 30 minutes. It is possible to change the interval, but the automatic Puppet-agent runs should be disabled completely.


Attempt one

According to this documentation it should be possible to disable automatic Puppet-agent runs by configuring the following:

/etc/puppet/puppet.conf

[agent]
daemonize=false

results in

Notice: Run of Puppet configuration client already in progress; 
skipping  (/var/lib/puppet/state/agent_catalog_run.lock exists)

if puppet is run manually at the default run interval of 30minutes.


Attempt two

user@hostname:~$ sudo puppet agent --disable

results in

user@hostname:~$ sudo puppet agent -t
Notice: Skipping run of Puppet configuration client; 
administratively disabled (Reason: 'reason not specified');
Use 'puppet agent --enable' to re-enable.

Attempt three

This documentation was found after googling the question of this Q&A, but the provided information did not answer the question.

  • 2
    Attempt one should work. If it was already running you have to stop it yourself. This just prevents future instances from daemonizing. If I am missing something, please clarify why this didn't work. You can also chkconfig puppet off && service puppet stop on Red Hat and derivatives. – Aaron Copley Jan 7 '15 at 15:54
  • @AaronCopley Thank you for the advice. I have disabled and stopped puppet and will monitor whether it does not run again every 30 minutes. The daemonize=false setting still resides in the Agent section in /etc/puppet/puppet.conf – 030 Jan 7 '15 at 16:09
  • @AaronCopley Could you post the comment as an answer? – 030 Jan 7 '15 at 19:37
10

"Attempt one" should have worked. If it was already running you have to stop it yourself. This just prevents future instances from daemonizing. If I am missing something, please clarify why this didn't work. You can also chkconfig puppet off && service puppet stop on Red Hat and derivatives.

  • Perhaps it did not work the first time as the puppet agent was not restarted. Tomorrow I will verify whether executing the provided command solved the issue. – 030 Jan 7 '15 at 22:01
4
+50

You need to ensure that the puppet agent is not starting as a service. Commands like systemctl, or chkconfig are your friend here (e.g. systemctl disable puppet or chkconfig puppet off). Not sure about most distros.

Then you should also make sure that the agent is stopped. E.g. systemctl stop puppet or service stop puppet.

You can also just use puppet to accomplish the above:

puppet apply <(echo "service { puppet: ensure => false, enable => false }")

If it still doesn't work, pkill puppet for good measure, then try again, if it still doesn't work - reboot.

3

Are you looking for a command like:

puppet agent --disable
  • Thank you for posting an answer. Executing this command results in Error: Could not parse application options: invalid option: --disable – 030 Jan 7 '15 at 16:19
  • 1
    should be puppet agent --disable – dmourati Jan 7 '15 at 16:21
  • @dmourati It this command has been executed. sudo puppet agent -t results in Notice: Skipping run of Puppet configuration client; administratively disabled (Reason: 'reason not specified'); Use 'puppet agent --enable' to re-enable. – 030 Jan 7 '15 at 16:22
  • @TomOnTime This has already been tried. Once this command has been executed it is not possible to run puppet manually anymore (Documentation of Attempt2 in the question) – 030 Jan 7 '15 at 16:23
  • 1
    That's what you wanted: Administratively disabled. If you need to run manually while administratively disabled: puppet agent --enable; puppet agent --test; puppet agent --disable – dmourati Jan 7 '15 at 16:31
1

I wouldn't expect the daemonize option to affect this - I'd expect that to control whether the program backgrounds itself and detaches from the terminal.

https://docs.puppetlabs.com/references/stable/configuration.html#runinterval says ...

runinterval

How often puppet agent applies the catalog. Note that a runinterval of 0 means “run continuously” rather than “never run.” If you want puppet agent to never run, you should start it with the --no-client option. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y).

which seems more relevant (the reference to starting with --no-client rather than the setting itself).

When we need to stop puppet making regular changes we just stop the service on the managed node. That obviously means that you need to be able to invoke a one-off run through some other mechanism (we don't do this often so just run from the shell).

With this setup puppetd is running but not doing regular updates (that's my expectation - I'm trying this on a test machine but not enough time has passed yet).

Running puppet agent --test will cause a single run but won't schedule any future runs.

  • Thank you for posting an answer. Does this mean that if someone accidentally runs, e.g. sudo puppet agent -t that the scheduled run will be reactivated? – 030 Jan 7 '15 at 16:21
  • No, the -t implies no-daemonize. (As well as onetime, verbose, ignorecache, no-usecacheonfailure, detailed-exit-codes, no-splay, and show_diff.) You can see this in the output of puppet agent help. – Aaron Copley Jan 7 '15 at 16:30
1

sudo service puppet stop if you are running the puppet daemon

Or delete the cronjob if that is how you have it configured.

  • Does the install of a Puppet agent result in the installation of a cron job as well? I have not configured a cronjob to run Puppet myself. – 030 Jan 7 '15 at 16:36
  • No, a default installation does not result in a created cron job. If you choose to run Puppet without the daemonized service, you can create a cron job yourself. – Aaron Copley Jan 7 '15 at 16:55
1
puppet --version

returns

5.3.3

puppet resource service puppet ensure=stopped enable=false

returns

Notice: /Service[puppet]/ensure: ensure changed 'running' to 'stopped'
service { 'puppet':
  ensure => 'stopped',
  enable => 'false',
}

The opposite of stopped is running. The opposite of false is true. ;)

0

As I mentioned in linked question, one possibility to have runned puppet-agent and disable configuration run, it change runinterval to very large value, like 10 years or something like that. But this solution still trigger configuration run after agent restart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.