Chef-solo tutorial


#1

Hi all,

I tried to run Chef Solo in CentOS 5.5. I followed the installation instruction using rpm installation wiki page:
http://wiki.opscode.com/display/chef/Installation+on+RHEL+and+CentOS+5+with+RPMs

Then followed the chef-solo wiki page:
http://wiki.opscode.com/display/chef/Chef+Solo

The resolver cookbook was downloaded using knife:

Knife cookbook site download resolver

The node.json was created as indicated by the example, and ran:

Chef-solo -j node.json -r resolver-0.8.2.tar.gz

It throws this exception:

[Thu, 24 Feb 2011 17:47:11 +0000] INFO: Setting the run_list to [“recipe[resolver]”] from JSON
[Thu, 24 Feb 2011 17:47:11 +0000] INFO: Starting Chef Run (Version 0.9.8)
[Thu, 24 Feb 2011 17:47:11 +0000] ERROR: Running exception handlers
[Thu, 24 Feb 2011 17:47:11 +0000] ERROR: Exception handlers complete
[Thu, 24 Feb 2011 17:47:11 +0000] ERROR: Re-raising exception: Chef::Exceptions::CookbookNotFound - Cookbook resolver not found
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/cookbook/cookbook_collection.rb:38:in initialize' /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/mash.rb:29:incall’
/usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/mash.rb:29:in default' /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/mash.rb:29:indefault’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/mixin/language_include_recipe.rb:39:in []' /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/mixin/language_include_recipe.rb:39:ininclude_recipe’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/mixin/language_include_recipe.rb:27:in each' /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/mixin/language_include_recipe.rb:27:ininclude_recipe’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/run_context.rb:94:in load' /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/run_context.rb:91:ineach’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/run_context.rb:91:in load' /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/run_context.rb:55:ininitialize’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/client.rb:84:in new' /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/client.rb:84:inrun’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/application/solo.rb:191:in run_application' /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/application/solo.rb:181:inloop’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/application/solo.rb:181:in run_application' /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/application.rb:62:inrun’
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/chef-solo:25
/usr/bin/chef-solo:19:in `load’
/usr/bin/chef-solo:19

I also tried to place the tarball in /var/lib/chef/cookbooks directory, but it shows the same exception.
What am I missing?

Regards,
Eric


#2

On 25 February 2011 01:52, Eric Yang eyang@yahoo-inc.com wrote:

Chef-solo –j node.json –r resolver-0.8.2.tar.gz

That doesn’t look like a URL to me.

From the wiki page you cited: “-r, --recipe-url RECIPE_URL”

Jonathan

Jonathan Matthews
London, UK
http://www.jpluscplusm.com/contact.html


#3

Local path names should work fine as URLs for the recipe bundle argument–we
do this all the time (albeit with an old version of Chef).

However, I think chef-solo expects the tarball you give it to have a
directory structure of the form

cookbooks/
   |---- cbname1/
   |       |--attributes/ ... etc
   ...
   |---- cbname2/
   |       |--attributes/
   ...

In other words, if your resolver-0.82.tar.gz just extracts into a single
directory resolver/, or even dumps the metadata.rb, attributes/, recipes/
etc entries into the current directory, you need to make a new tarball which
has that cookbook within a toplevel cookbooks/ directory, with
cookbooks/resolver/ under that.

See the Rakefile task for bundling cookbooks for details…

Michael

On Thu, Feb 24, 2011 at 6:06 PM, Jonathan Matthews
contact@jpluscplusm.comwrote:

On 25 February 2011 01:52, Eric Yang eyang@yahoo-inc.com wrote:

Chef-solo –j node.json –r resolver-0.8.2.tar.gz

That doesn’t look like a URL to me.

From the wiki page you cited: “-r, --recipe-url RECIPE_URL”

Jonathan

Jonathan Matthews
London, UK
http://www.jpluscplusm.com/contact.html


#4

This is exactly what I missed. Works great after the structure change. Chef-solo wiki should include your example. :slight_smile: Thank you, Michael.

Regards,
Eric

On 2/24/11 6:45 PM, “Michael Callahan” mjcmirr@gmail.com wrote:

Local path names should work fine as URLs for the recipe bundle argument–we do this all the time (albeit with an old version of Chef).

However, I think chef-solo expects the tarball you give it to have a directory structure of the form

cookbooks/
   |---- cbname1/
   |       |--attributes/ ... etc
   ...
   |---- cbname2/
   |       |--attributes/
   ...

In other words, if your resolver-0.82.tar.gz just extracts into a single directory resolver/, or even dumps the metadata.rb, attributes/, recipes/ etc entries into the current directory, you need to make a new tarball which has that cookbook within a toplevel cookbooks/ directory, with cookbooks/resolver/ under that.

See the Rakefile task for bundling cookbooks for details…

Michael

On Thu, Feb 24, 2011 at 6:06 PM, Jonathan Matthews contact@jpluscplusm.com wrote:
On 25 February 2011 01:52, Eric Yang eyang@yahoo-inc.com wrote:

Chef-solo -j node.json -r resolver-0.8.2.tar.gz

That doesn’t look like a URL to me.

From the wiki page you cited: “-r, --recipe-url RECIPE_URL”

Jonathan

Jonathan Matthews
London, UK
http://www.jpluscplusm.com/contact.html


#5

On Thu, Feb 24, 2011 at 7:00 PM, Eric Yang eyang@yahoo-inc.com wrote:

Chef-solo wiki should include your example. :slight_smile: Thank you, Michael.

Contributions to the wiki are always encouraged and appreciated =D.

Bryan


#6

And now the wiki page is updated. Thanks :slight_smile:

On Thu, Feb 24, 2011 at 7:03 PM, Bryan McLellan btm@loftninjas.org wrote:

On Thu, Feb 24, 2011 at 7:00 PM, Eric Yang eyang@yahoo-inc.com wrote:

Chef-solo wiki should include your example. :slight_smile: Thank you, Michael.

Contributions to the wiki are always encouraged and appreciated =D.

Bryan

Tom Thomas | Opscode, Inc.
tom@opscode.com | © 206.234.1193 | www.opscode.com


#7

Looks great. Thanks all. :slight_smile:

Regards,
Eric

On 2/25/11 11:07 AM, “Tom Thomas” tom@opscode.com wrote:

And now the wiki page is updated. Thanks :slight_smile:

On Thu, Feb 24, 2011 at 7:03 PM, Bryan McLellan btm@loftninjas.org wrote:
On Thu, Feb 24, 2011 at 7:00 PM, Eric Yang eyang@yahoo-inc.com wrote:

Chef-solo wiki should include your example. :slight_smile: Thank you, Michael.

Contributions to the wiki are always encouraged and appreciated =D.

Bryan