Chef-client running


#1

I am new to chef. so far in some videos i see every time chef-client was run to execute the cookbooks .
so do we need to login into nodes every time and run chef-client ? .

is there any other way just to trigger from work station , so recipes can run remotley in selected nodes ?


#2

Hi @prashi89

From the chef workstation you fire commands over ssh, winrm or push jobs
https://docs.chef.io/knife_ssh.html#examples
https://docs.chef.io/plugin_knife_windows.html#examples

You can also configure your nodes to have chef-client running as a service


#3

Thanks simark .
if we push chef-client all the assigned run-lists will get executed right , so instead of that can we push only selected recipes at a time ?

like for example if i want to patch some service , i need to execute only some cookbooks and not all the assigned cookbooks . so can i still run that way ?


#4

You can specify the -o option which will override the existing runlist for the that particular chef-client run, but it will not change the runlist configured in the chef-server

-o RUN_LIST_ITEM , --override-runlist RUN_LIST_ITEM
Replace the current run-list with the specified items. This option will not clear the list of cookbooks (and related files) that is cached on the node. This option will not persist node data at the end of the client run.
New in Chef Client 12.0.

https://docs.chef.io/ctl_chef_client.html


#5

Thanks a lot simark ..