How do I use chef provisioning with chef zero with recipes that contain dependencies?

368 Views Asked by At

I'm very new to Chef and I'm attempting to provision a VM on my vsphere node using "chef provisioning".

When I execute the following

chef-client -z -o 'my_company::vsphere' 'my_company::test_cluster'

I get the following error:

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: firewall

After doing some research, I came across this question and discussion: Why can't chef resolve my cookbooks?

Here Tejay Cardon, mentions that the berks path should be called out in the cookbook_path configuration in knife.rb (at least that's how I interpreted it). I added it and now my file looks like this:

# See https://docs.getchef.com/config_rb_knife.html for more information on knife configuration options

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "empl1234"
client_key               "#{current_dir}/empl1234.pem"
chef_server_url          "https://my_chef_box/organizations/my_org"
cookbook_path            ["#{current_dir}/../cookbooks", "C:/Users/empl1234/.berkshelf/cookbooks"]

When I run the command outlined above, I still get the same error.

As I mentioned above, I am learning chef and so if the answer is obvious, please be kind about it. And I've done a lot of googling, so if the answer is "google it! I got the exact page you needed as the first link", then please give me the terms to google. :) Thanks!

1

There are 1 best solutions below

0
On

Apparently I didn't read close enough. The answer is to export all dependencies using the following command:

berks vendor path_to_hold_cookbooks

Then put path_to_hold_cookbooks as the cookbook_path in .chef/knife.rb