[chef] Re: Preferred Attribute locations


Chronological Thread 
  • From: Denis Haskin < >
  • To:
  • Subject: [chef] Re: Preferred Attribute locations
  • Date: Tue, 17 Jul 2012 10:13:21 -0400

When we first structured our attributes, we found this table to be invaluable: http://wiki.opscode.com/display/chef/Attributes#Attributes-Precedence

And in fact it is explicitly referred to in several places in our source code ;-)

The "not to use attributes at environment" assertion seems overly broad.  I'd say *most* of our attributes are defined at the environment level, since our environments (prod, staging, qa) are virtually identical *except* for the variants which are controlled by these environment attributes.

For example, our application has an archive database, but except when we're explicitly testing it, we only stand up an archiving database in our production environment; that's controlled via environment attributes.

In practice, we find we define attributes pretty much only at environment and role.  But YMMV.

--
Denis Haskin




On Tue, Jul 17, 2012 at 9:47 AM, Dylan Northrup < " target="_blank"> > wrote:
At my day job, we're having a discussion on the proper location for attributes and it was suggested to ask the question on this list to see what the community has to say.

The assertion initially made was to not use attributes at the Environment level (since there's one and only one Environment per node it is a limiting place to put attributes).  The questions that came up from this assertion were as follows:

- At what level should attributes be set?   

- At the file, role or node level?  

- Does it matter if we're using default, normal/set or override for setting the attributes (other than for precedence's sake)?  

- Also, does the answer change depending on what the particular attribute is?  

- Is there a logical set of attributes that should be defaulted at the role level and overridden at the file level?  

- Or is the usage wide open with the exception of using attributes at the environment level?


Looking at several cookbooks, it appears most cookbooks that have attributes have "default" attributes (with exceptions being relatively old ones).  Also, role attributes tend to be "override" attributes.  Is this what can be considered "best practice"? Are there cases where this approach is not the preferred approach?

--
Dylan




Archive powered by MHonArc 2.6.16.

§