问题
Hy I'm trying to run a MongoDB recipe with Chef Solo on an Amazon EC2 Linux AMI. I've installed Omnibus, set the cookbook path in the .rb file, and the runlist in the .json file. I've copied the content of the mongodb recipe zip from github to to cookbook folder, and ran the chef-solo command. The result is below:
FATAL: Chef::Exceptions::CookbookNotFound: Cookbook apt not found. If you're loading apt from another cookbook, make sure you configure the dependency in your metadata
I'm pretty new to Linux too, what am I doing wrong here?
回答1:
The error is pretty descriptive. You likely have a cookbook in your runlist that has depends apt
in its metadata.rb
file.
Luckily, this easy to resolve - just include the apt
cookbook (https://github.com/opscode-cookbooks/apt) in your cookbooks
folder and call it in your runlist (or role, when you get to that level).
回答2:
If you are using chef-solo
, make sure your solo.rb
points to the correct cookbook location. I had set it as :
cookbook_path "/root/chef-repo/cookbooks"
instead of:
cookbook_path "/home/ubuntu/chef-repo/cookbooks"
回答3:
Karishma is correct in her answer, though I would like to expand on it and make it more dynamic by skipping the absolute paths. Here is my implementation:
root = File.absolute_path(File.dirname(__FILE__))
file_cache_path root
cookbook_path root + '/cookbooks'
It sets the paths to be wherever you place the solo.rb
file.
回答4:
This happened to me because I forgot to run librarian-chef install
first!
来源:https://stackoverflow.com/questions/15497610/chef-solo-error-cookbook-apt-not-found