librarian-chef
is a gem that makes installing and managing Chef cookbooks locally much easier. It's Bundler
for Chef basically. You have a Cheffile that specifies your cookbook dependencies and then you just run librarian-chef install
to install those cookbooks. You can install cookbooks via refs, paths, urls, github, etc. The interface and setup is identical to Bundler.
When you run librarian-chef install
it'll install the cookbooks that you've specified in the cookbooks
directory. You should ignore this directory from your git repository as librarian-chef
will take care of installing the appropriate cookbooks in there. You'll still need to upload them to your chef-server using knife cookbook upload COOKBOOK_NAME
. Within site-cookbooks
is where you'll put your custom cookbooks that are specific to your application. This directory should be tracked by git.
It's really simple to get Vagrant to install all of your cookbooks while it provisions the VM, you'll just need to point your provision settings within your Vagrantfile to the location of both cookbook directories. Something like the Vagrantfile below copies all of your libarian-chef managed cookbooks as well as your custom cookbooks over to the VM for provisioning. No need to install a plugin or anything additional.
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["site-cookbooks", "cookbooks"]
chef.roles_path = "roles"
chef.data_bags_path = "data_bags"
end
end