I have configured workstation up this step in get started (OS redhat 6.5). I have launched a node. I modified a cookbook like that:
myCookbook/metadata.rb
name 'myCookbook'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures myCookbook'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'maven'
E.g. only depends 'maven'
string was added after knife cookbook create myCookbook
was executed.
myCookbook/recipes/default.rb
maven 'spring-context' do
group_id 'org.springframework'
version '4.0.4.RELEASE'
dest '/root/chef-repo/'
repositories ['http://repo.maven.apache.org/maven2/']
end
Then I run:
knife cookbook upload myCookbook
Now I am trying:
knife bootstrap 192.168.1.37 --ssh-user root --ssh-password '123456' --sudo --use-sudo-password --node-name node-with-maven-run --run-list 'recipe[myCookbook]'
And get:
ERROR: Cookbook myCookbook depends on cookbooks which are not currently
ERROR: being uploaded and cannot be found on the server.
ERROR: The missing cookbook(s) are: 'maven' version '>= 0.0.0'
How install all cookbook to chef server from that mtCookbook depends?
@rastasheep has described how the berkshelf tool is now bundled with the chefdk package.
It's really easy to use and worth learning. It's designed to work like the gem bundler tool.
Example
Berksfile
The "source" directive tells berkshelf where to download dependencies from. The "metadata" directive tells berkshelf to take dependencies from the cookbook metadata.
Using Berkshelf
The "install" command will download the cookbook dependencies (Cached under ~/.berkshelf)
Berkshelf can also upload all the cookbooks into your chef server
There is a few other options for managing cookbook cookbook and dependencies, such Berkshelf or Librarian-chef, where Berkshelf is more popular, and it's even included in Chef Development Kit, so if you use it you do not need to install it separately.
After defining sources you just need to define which cookbooks you want their versions and cookbook manager will resolve dependencies for all defined cookbooks and it will install them for you, and if you want you can vendor them too. Beside that they have an option to upload specific cookbook, without worrying about upload dependencies.
For more info how to use those tools consult official websites:
In general for managing small projects you can use knife's upload flag for uploading dependencies.
See here
Or just type
knife cookbook upload --help
and it will show you the following line (along others):--include-dependencies Also upload cookbook dependencies
So
knife cookbook upload myCookbook --include-dependencies
is your answerYou'll need to have the
maven
cookbook on your workstation too, byknife cookbook site install maven
or any other way to have a directory calledmaven
in your localcookbook_path
containing a cookbook where themetatada.rb
file as a keyname
with value maven