Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run a cookbook with a specific version using chef-client?

I am having 2 cookbooks name as mycookbook and version 0.1.0 and 0.1.1 on chef server. Now I want to run only cookbook mycookbook version 0.1.1 using chef-client. How do I do this ?

like image 641
Salim Avatar asked Feb 09 '15 07:02

Salim


People also ask

How do I check my Chef cookbook version?

If you can ssh into the box you can look under /var/chef/cache/cookbooks/<cookbook name>/metadata. json to find the version. Also, you can access it during a chef run by looking at @run_context.

How do you run a cookbook in Chef Workstation?

Step 1 − Install the cookbook using the following command. Step 2 − Run the knife cookbook test commands on the working cookbook. Step 3 − Break something in the cookbook and test again. Step 4 − Run the knife test command again.

How do you update the cookbook in Chef server?

To upload a specific cookbook, go to the chef-repo directory, specify the cookbook name along with the cookbook directory as shown below. This will upload prod-db cookbook from local machine to the Chef Server.


1 Answers

Found the answer with some hit and try

Ran following command

chef-client -o "recipe[[email protected]]"

This will call mycookbook version 0.1.1

NOTE: Running chef-client with the -o parameter will permanently override the runlist for that node.

like image 163
Salim Avatar answered Oct 13 '22 20:10

Salim