Skip to end of metadata
Go to start of metadata

Review

Attributes are Node data such as the IP address, hostname, loaded kernel modules, version of programming languages available on the system and more.

During the Chef run, the Chef Client saves node attributes on the Chef Server where they are indexed for Search.


Use of Automatic Attributes in Recipes

Node attributes can be set in recipes. This use of node attributes should do done when you want to calculate a derived value, or store some data on the node that should be persisted the next time Chef runs. For more information on the use within recipes, see Node Attributes within Recipes.

Automatic Attribute Precedence

Attributes are applied in precedence order - with the fourth attribute type, automatic, containing Ohai data and having the highest precedence. As these automatic attributes will be re-written with each Ohai run - Chef doesn't provide any way to modify them.

The following attributes are those which are re-written with each Ohai run, so they should be recognized as being unmodifiable when considering the use of attributes.

ohai$ grep -R "provides" -h lib/ohai/plugins|sed 's/^\s*//g'|sed "s/\\\"/\'/g"|sort|uniq|grep ^provides
provides 'block_device'
provides 'chef'
provides 'cloud'
provides 'command'
provides 'command/ps'
provides 'cpu'
provides 'dmi'
provides 'ec2'
provides 'etc', 'current_user'
provides 'eucalyptus'
provides 'filesystem'
provides 'fqdn', 'domain'
provides 'fqdn', 'hostname'
provides 'hostname', 'fqdn'
provides 'kernel'
provides 'kernel/os'
provides 'keys'
provides 'keys/ssh'
provides 'languages'
provides 'languages/c'
provides 'languages/erlang'
provides 'languages/groovy'
provides 'languages/java'
provides 'languages/lua'
provides 'languages/mono'
provides 'languages/perl'
provides 'languages/php'
provides 'languages/python'
provides 'languages/ruby'
provides 'lsb'
provides 'memory'
provides 'network'
provides 'network', 'counters/network'
provides 'network_ip_scope', 'privateaddress'
provides 'network/listeners'
provides 'ohai'
provides 'ohai_time'
provides 'os', 'os_version'
provides 'platform', 'platform_version'
provides 'platform', 'platform_version', 'platform_build'
provides 'rackspace'
provides 'system_profile'
provides 'uptime', 'idletime', 'uptime_seconds', 'idletime_seconds'
provides 'uptime', 'uptime_seconds'
provides 'virtualization'


You'll note that you can get this list directly yourself by running the command that produced it.


Additional attributes and sub-attributes can be viewed on a particular node by running ohai. This returns data as JSON.





Attributes


Deep Merge



Labels:
ohai-191 ohai-191 Delete
attributes attributes Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.