Working with Vagrant+Berkshelf to include local cookbook

When we use Vagrant+Chef+Berkshelf, you can manage cookbook by adding 

cookbook ‘ntp’

in Berksfile.  However, local developed cookbook that is not in the ~/.berkshelf folder will be ignored.   You can specify full path of the cookbook in Berksfile

cookbook ‘ntp’, path: ‘/Users/barrowkwan/chef-work/cookbooks/ntp’

Fortunately, Berksfile is executed as Ruby, you can leverage the following code to include or all selected cookbooks

Dir.glob[‘/Users/barrowkwan/chef-work/cookbook/**’].each do |mycookbook|

  cookbok File.basename(mycookbook), path: path

end

 

 

This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s