[chef] Re: making a library global?


Chronological Thread 
  • From: Joshua Timberman < >
  • To:
  • Subject: [chef] Re: making a library global?
  • Date: Fri, 16 Jul 2010 16:42:26 -0600

Hello!

On Jul 16, 2010, at 4:38 PM, Paul Choi wrote:

> The wiki says:
> "Any libraries you include in a Cookbook will automatically be required, 
> and available within all your Recipes, Attribute Files and Definitions."
> 
> Is there a way to make a library global so that it's available to all 
> cookbooks?

Two ways.

1. Include the cookbook in the run list of the node, or a role on the node. 
It doesn't have to do anything - the default.rb can be blank. E.g.,

{ "run_list": [ "recipe[your_library_cookbook]" ] }

That will cause it to be downloaded, and its libraries loaded on the node.

2. Put the cookbook in the metadata of any cookbooks you want to use the 
library in. E.g.,

depends "your_library_cookbook"

In metadata.rb of another cookbook where you want to use the library.

-- 
Opscode, Inc
Joshua Timberman, Senior Solutions Engineer
C: 720.334.RUBY E: 





Archive powered by MHonArc 2.6.16.

§