[chef] Re: Decoupling cookbooks


Chronological Thread 
  • From: Silviu Dicu < >
  • To: " " < >
  • Subject: [chef] Re: Decoupling cookbooks
  • Date: Fri, 14 Feb 2014 20:42:41 -0500

Hi,

You could use a common cookbook with different recipes to contain the attributes relevant to your datacenter(s).
common_cookbook/recipes/
  dc1.rb
  dc2.rb

-silviu


On Fri, Feb 14, 2014 at 5:37 PM, Douglas Garstang < " target="_blank"> > wrote:
I've been trying to decouple cookbook attributes. At the moment, we have one role per physical location, ie a data center. Some of the attributes defined in the role are common to multiple cookbooks (eg: a database server for example). Since things are still in a state of flux, these attributes are changing frequently. When the common attribute name changes, it breaks multiple cookbooks.

I wanted a way to de-couple those attributes, at least for now. I figured some common ones could maybe be placed back into roles later. I had the idea I could use environments, where each environment was a physical location. I was going to put all the attributes for cookbook foo into a role defined inside the cookbook, and maintained as part of that cookbook. However, I just realised that updating an environment with the same name from a different cookbook overwrites the attributes of the previous cookbook completely.

I suppose a first step could be to move the attributes out of the roles and into cookbook attributes. However, if I do this I'm not sure what the most efficient way is to adequately convey each location with the cookbook attributes. Just use sub keys ?

Doug





Archive powered by MHonArc 2.6.16.

§