I am working on chef and vagrant. I am trying to configure nginx with php-fpm and spin-up new server using chef-solo. Here is the configuration of my vagrant file.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu-15.10"
config.vm.box_url = 'https://cloud-images.ubuntu.com/vagrant/wily/current/wily-server-cloudimg-amd64-vagrant-disk1.box'
config.vm.network "private_network", ip: "182.217.46.65"
config.vm.provision :chef_solo do |chef|
chef.run_list = [
"recipe[nginx-php-fpm]"
]
end
When I run vagrant up everything runs perfect but nginx do not install and in stacktrace of vagrant instance I get below exceptions.
Chef::Exceptions::CookbookNotFound: Cookbook nginx not found. If you're loading nginx from another cookbook, make sure you configure the dependency in your metadata
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/cookbook/cookbook_collection.rb:38:in `block in initialize'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/ohai-8.10.0/lib/ohai/mash.rb:77:in `yield'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/ohai-8.10.0/lib/ohai/mash.rb:77:in `default'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/ohai-8.10.0/lib/ohai/mash.rb:77:in `default'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:275:in `[]'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:275:in `each_cookbook_dep'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:254:in `add_cookbook_with_deps'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:255:in `block in add_cookbook_with_deps'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:276:in `each'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:276:in `each_cookbook_dep'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:254:in `add_cookbook_with_deps'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:88:in `block in cookbook_order'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:86:in `each'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:86:in `cookbook_order'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:98:in `compile_libraries'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:71:in `compile'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:167:in `load'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/policy_builder/expand_node_object.rb:93:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:509:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:277:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:270:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:223:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:211:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/solo.rb:297:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/solo.rb:286:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/solo.rb:286:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/solo.rb:265:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:58:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:50:in `load'
/usr/bin/chef-solo:50:in `<main>'
While nginx is already defined as dependency in my metadata.rb file. I got these errors in /var/chef/cache/chef-stacktrace.out of vagrant instance. I would highly appreciate any help for where to look in.
Thanks
If you've made the dependency known in your cookbook's metadata.rb, the next step chef-solo will take is to look for a cookbook named
nginx
.This means the cookbook must be downloaded/supplied to the running vagrant box in some manner.
You may want to explore using Berkshelf on your host machine with cookbook retrieval.
Berkshelf is included in ChefDK.