[chef] Re: platform agnostic roles and/or cookbooks


Chronological Thread 
  • From: Brad Knowles < >
  • To:
  • Cc: Brad Knowles < >
  • Subject: [chef] Re: platform agnostic roles and/or cookbooks
  • Date: Sat, 12 May 2012 22:29:24 -0500

On May 12, 2012, at 6:17 PM, Jay Feldblum wrote:

> You could write your own recipe in your own custom "my-base" cookbook.
> 
> In your "my-base" cookbook's default recipe, you can write:
> 
> if platform?("ubuntu")
>   include_recipe "apt"
> end
> 
> In your "my-base" cookbook's metadata, be sure to write:
> 
> depends "apt"

However, that would mean that all the rhel/centos boxes would suddenly become 
dependent on the apt cookbook, even though they don't use apt.  The apt 
recipe might not be added to the run list, but the dependency would still be 
there.

Personally, I would create OS-specific roles & cookbooks for the stuff that 
needs to be os-specific (like depending on apt), and then include all the 
generic stuff that doesn't need to care what particular platform you're 
running on.

--
Brad Knowles 
< >
LinkedIn Profile: <http://tinyurl.com/y8kpxu>




Archive powered by MHonArc 2.6.16.

§