Attributes order precedence

Setting Attributes


 Work in progress

Environments attributes are only going to be available in Chef 0.10.0 or above.

Attributes may be set on the node, in order of precedence, from the following objects

  • cookbooks
  • environments (Chef 0.10.0 or above only)
  • roles
  • nodes

Combining the precedence and the places where attributes can be set, we derive this chart:

 Attributes File 	Role 	Environment 	Recipe 	

Default 1 2 n/a 3
Normal 4 n/a n/a 5
Override 6 7 8 9

default attributes applied in an attributes file have the lowest priority and override attributes applied on a node directly in a recipe have the highest priority. Again, the exception to this are automatic attributes, as these are regenerated by Ohai http://wiki.opscode.com/display/chef/Ohai every time Chef runs.


I think that there is a mistake and confusion in the wiki about order precedence of attributes

The last column of the chart above should be “Node” not “Recipe” while the first column should be “Cookbook”

Huy Le
Tecnología ING DIRECT
Administrador de sistema
Tel: +34 91 206 76 85

Por favor, no imprima este correo si no es necesario.


ATTENTION:
The information in this electronic mail message is private and
confidential, and only intended for the addresses. Should you
receive this message by mistake, you are hereby notified that
any disclosure, reproduction, distribution or use of this
message is strictly prohibited. Please inform the sender by
reply transmission and delete the message without copying or
opening it.

On Mon, Nov 22, 2010 at 3:03 AM, le.huy@ingdirect.es wrote:

I think that there is a mistake and confusion in the wiki about order
precedence of attributes

The last column of the chart above should be "Node" not "Recipe" while the
first column should be "Cookbook"

If it's confusing, it should be fixed, but it's written the way that it is
because attributes files and recipes are both parts of cookbooks, so it's
less ambiguous to say "attributes file" and "recipe."

Dan DeLeo