1.

Why is Ohai used in Chef?

Answer»

Ohai in Chef is used to detect Chef node attributes and these are provided to chef-client during the Chef Client run. Ohai collects details about various platforms, network data, memory data, CPU data, KERNEL data and other configuration details. All these attributes COLLECTED are automatic attributes that are not changed even after Chef Client run. Automatic attributes are having higher precedence overall default, override, force-default and normal attributes. Ohai gets INSTALLED with the Chef Client installation.

The ohai resource is available in Chef to reload the configuration of a node. These are often used to refer back system attributes that are changed by a recipe like a recipe that creates a new user during a Chef Client run. The syntax is as follows : 

ohai 'name' do plugin   String action   Symbol # defaults to reload if not specified end

where:

  • ohai is the resource executed.
  • name is the resource BLOCK name.
  • action is PERFORMED to bring the node into the desired state.
  • a plugin is the property of the resource.


Discussion

No Comment Found