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
Run as Non-root User The default configuration of the chef-client assumes that it is run as the root user.
For :restart, the init script or other service provider can use a restart command; if :restart is not specified, the chef-client attempts to stop and then start a service. For :reload, the init script or other service provider can use a reload command.
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.
sudo systemctl stop chef-client
worked for me on RHEL 7.5 64-bit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With