chef-infrachef-zero

Overriding run list with chef zero


I have a folder "root-folder" which contains two custom cookbooks.

- root-folder \ -this-cookbook -that-cookbook

I can cd into and run either cookbook directly

for example: chef-client -z -o this-cookbook -j ../config.json

Really I want to be able to cd into root-folder and run

chef-client -z -o "this-cookbook, that-cookbook" -j config.json

but that doesn't work. Is it possible?


Solution

  • You have several options but the easiest will be to put the cookbooks in a directory called cookbooks.

    - root-folder \ - cookbooks \ -this-cookbook -that-cookbook

    And then run chef-client from the root-folder.

    Reference: https://docs.chef.io/ctl_chef_client.html#run-in-local-mode

    Also -o specifies a run-list override so your current command won't work. It will need to be something like this:

    -o 'recipe[this-cookbook],recipe[that-cookbook]'

    Reference: https://docs.chef.io/run_lists.html