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 ?
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.
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.
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.
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.
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