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
defaultattribute is automatically reset at the start of every Chef Infra Client run and has the lowest attribute precedence. Usedefaultattributes 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
normalattribute is a setting that persists in the node object. Anormalattribute has a higher attribute precedence than adefaultattribute. override- An
overrideattribute is automatically reset at the start of every Chef Infra Client run and has a higher attribute precedence thandefault,force_default, andnormalattributes. Anoverrideattribute 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 usesoverrideattributes 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
automaticattribute contains data that’s identified by Ohai at the beginning of every Chef Infra Client run. Anautomaticattribute can’t be modified and always has the highest attribute precedence.