Attribute Types
Chef Infra Client uses six types of attributes to determine the value that’s applied to a node during a Chef Infra Client run. In addition, Chef Infra Client gathers attribute values from up to five locations. The combination of attribute types and sources makes up to 15 different competing values available during a Chef Infra Client run.
The attribute types are:
default
- A
default
attribute is automatically reset at the start of every Chef Infra Client run and has the lowest attribute precedence. Usedefault
attributes as often as possible in cookbooks. force_default
- Use the force_default attribute to ensure that an attribute defined in a cookbook (by an attribute file or by a recipe) takes precedence over a default attribute set by a role or an environment.
normal
- A
normal
attribute is a setting that persists in the node object. Anormal
attribute has a higher attribute precedence than adefault
attribute. override
- An
override
attribute is automatically reset at the start of every Chef Infra Client run and has a higher attribute precedence thandefault
,force_default
, andnormal
attributes. Anoverride
attribute is most often specified in a recipe, but can be specified in an attribute file, for a role, and/or for an environment. A cookbook should be authored so that it usesoverride
attributes only when required. force_override
- Use the force_override attribute to ensure that an attribute defined in a cookbook (by an attribute file or by a recipe) takes precedence over an override attribute set by a role or an environment.
automatic
- An
automatic
attribute contains data that’s identified by Ohai at the beginning of every Chef Infra Client run. Anautomatic
attribute can’t be modified and always has the highest attribute precedence.