[chef] Re: Re: Preferred Attribute locations


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Re: Preferred Attribute locations
  • Date: Tue, 17 Jul 2012 19:50:49 +0530

i prefer to have default values of all the attributes in the cookbook, 
the next level where we aggregate recipes within a role , we still prefer default
while on the environment wide customization (like environment specific dns server etc) we use override. 

On Tue, Jul 17, 2012 at 7:37 PM, Mike < " target="_blank"> > wrote:
One idea that has surfaced is the preferred cookbook:
https://github.com/dcrosta/cookbook-preferred

I tend to place all default, "sane" attributes at the node level, then
default at the role level, and override at the environment level.

Some cookbooks use "set/normal" and you should be aware of what
implication that has on setting attributes at another level.

Reference: http://wiki.opscode.com/display/chef/Attributes#Attributes-Precedence

Consider:

cookbook/recipe defaults for every node that is going to have the
attribute. e.g. "default['logdir'] = "/var/log/"

role defaults/overrides for role-specific behavior, e.g.
default_attributes('logdir' => "/var/log/myrole/")

environment overrides for something specific to this particular
environment, e.g override_attributes('logdir =>
"/var/log/myrole/staging/")

Hope this helps,
-Michael

On Tue, Jul 17, 2012 at 9:47 AM, Dylan Northrup < "> > 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.

§