1.

Explain different types of attributes in Chef?

Answer»

Attributes define a node! In other words, it’s a characteristic of your node when it runs in a specific role under a specific environment against a specific cookbook or recipe. Hence attributes can be found in all these Chef components such as roles, environment, cookbooks and even as a separate set called “attribute files”. The different types of attributes available in the chef are:-

  1. default: This is the most generic type of attribute and also the one with the lowest precedence. These are largely used in cookbooks so that nodes remain the same WAY as they are and function further. At the start of every Chef Client run, the default attributes are reset automatically
  2. force_default: As the name suggests with the use of these attributes, the default attributes are forced to TAKE up the new VALUES assigned to them. The use of force_default attributes comes when we want our nodes to run in a different role or environment.force_default attributes defined in a cookbook have higher precedence than default attributes defined in a role or environment.
  3. normal: Unlike default attributes, these are not reset during a new Chef Client run. They just persist in the node object.
  4. override: Generally found in recipes and are used to override any default, force_default or normal attributes. These are also reset before a    Chef Client run.
  5. forced_override: These attributes MAKE SURE that the override attributes defined in a cookbook are forced to take up the new values assigned to them.
  6. automatic: These attributes are defined by Ohai to mainly understand the state of the node at the beginning of a Chef Client run. These have the highest precedence


Discussion

No Comment Found