[chef] Decoupling cookbooks


Chronological Thread 
  • From: Douglas Garstang < >
  • To:
  • Subject: [chef] Decoupling cookbooks
  • Date: Fri, 14 Feb 2014 14:37:23 -0800

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.

§