Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable chef-client run

Tags:

chef-infra

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

like image 308
Virender Khatri Avatar asked Apr 27 '14 09:04

Virender Khatri


People also ask

What user does chef client run as?

Run as Non-root User The default configuration of the chef-client assumes that it is run as the root user.

How do I restart chef client service?

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.


2 Answers

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.

like image 161
JeanMertz Avatar answered Oct 24 '22 22:10

JeanMertz


sudo systemctl stop chef-client

worked for me on RHEL 7.5 64-bit

like image 1
user674669 Avatar answered Oct 24 '22 22:10

user674669