5
votes

I want to disable chef-client run instead of stopping chef-client service or removing cron job schedule which means chef-client will never run again unless run manually.

Coming from puppet background, I am looking for an alternative like "puppet agent --disable" which will keep the chef-client service/cron running but it will not alter any resource.

It is more likely forcing every chef-client run into --why-run mode. Very useful while during upgrades or application deployment. It will allow to make revision/version change in chef role/recipe and apply in set of nodes, otherwise chef-client service or cron has to stop/disable first and re-enabled later which is not a right approach.

I do not see any such option in chef-client binary.

Chef Server and Client version - 11.8.2.

-thanks

4

4 Answers

4
votes

which is not a right approach.

Why would you say that? Stopping and starting a service was designed exactly for these kind of situations. Simply use (depending on your preferred way of managing services) service stop chef-client and then run service start chef-client again once you are ready to resume operations.

We use this very regularly, when we want to mess with some configurations on a server before applying them to the Chef scripts. This makes sure Chef doesn't run during our messing around and reverts our manual changes.

1
votes
sudo systemctl stop chef-client

worked for me on RHEL 7.5 64-bit

0
votes
/etc/init.d/chef-client stop

worked for me on CentOS release 6.6 (Final) running 2.6.32-504.16.2.el6.x86_64 kernel

0
votes

Reasons for wanting something like this -- and I'm thinking of Puppet too -- include:

  • Wanting to test something on a system for an extended time without Chef clobbering it. Lab / virtual test systems don't always suffice.

  • Not having to trouble 24/7 staff with an alert because I stopped the service on a specific system

Looking for some semaphore file in /var/chef would be trivial to implement.