Information Technology Reference
In-Depth Information
Figure 8-2. Setting attributes in recipes
Because attributes can be defined in multiple places, all attribute values are composed to-
gether during a Chef run according to the priority levels as shown in
Figure 8-3
.
Attributes
defined by
ohai
have the highest priority, followed by attributes defined in a recipe, then at-
tributes defined in an attribute file. In other words, recipe attributes have a higher priority
than those defined in attribute file, and will override them by default. Attributes defined by
ohai
trump everything else.
Figure 8-3. Attribute priority
We'll talk more about precedence levels later in this chapter. However, when setting an at-
tribute in a cookbook, it should (almost) always be a
default
attribute with
default
preceden-
ce.