HaveF
HaveF

Reputation: 3065

vagrantfile cookbook path

I want to set the cookbook path to a certain place, so that I don't need to modify the Vagrantfile everytime(after vagrant init).

I find Vagrantfile load several places, so I decide to set my cookbook path info in ~/.vagrant.d/Vagrantfile,(this file is the 3rd of Vagrantfile Load Order) like:

...
   config.vm.provision :chef_solo do |chef|
     chef.cookbooks_path = ["D:/lib/chef/cookbooks"]
     chef.add_recipe "dev::default"
   end
...

but when I make a new vm, and modify Vagrantfile(this file is the 4th of Vagrantfile Load Order):

...
  config.vm.provision :chef_solo do |chef|
     chef.add_recipe "torch"
  end
...

error:

[2013-02-28T03:23:36+00:00] ERROR: Running exception handlers
[2013-02-28T03:23:36+00:00] ERROR: Exception handlers complete
[2013-02-28T03:23:36+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-02-28T03:23:36+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook torch not found. If
you're loading torch from another cookbook, make sure you configure the dependency in your metadata
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

but I am sure the specific cookbook is under my cookbook path.

Upvotes: 0

Views: 1656

Answers (1)

Max
Max

Reputation: 180

Try the following steps: - Create a folder cookbooks in the vagrantfile's directory - checkout the cookbooks to this directory - add the following to your vagrantfile

 chef.cookbooks_path = ["cookbooks"]

hope to have helped

Upvotes: 1

Related Questions