Ohai detects attributes on the node based on its own plugin system. The most commonly accessed attributes are:
- node['platform'] - The node's platform. This determines what Providers are used by Resources.
- node['platform_version'] - The node's platform version. This may be used in determining Providers as well.
- node['ipaddress'] - The node's ipaddress is IPV4 address of the interface that has the default route. If the node does not have a default route, this attribute will be nil. Using the IP of the interface with the default route is deemed the most sane default.
- node['macaddress'] - The node's macaddress, from the interface detected for ipaddress above.
- node['fqdn'] - The fully qualified domain name, for example from hostname -f on Unix/Linux systems. This is also used as the node name unless otherwise set.
- node['hostname'] - The hostname is the first field from splitting the FQDN on "." (dot).
- node['domain'] - The domain is the rest of the FQDN after splitting on "." (dot).
- node['recipes'] - The node's Run List is expanded for roles and recipes, and recipes are stored in this attribute.
- node['roles'] - The node's Run List is expanded for roles and recipes, and roles are stored in this attribute.
- node['ohai_time'] - Not commonly used in recipes, but this value is the time epoch of the node when ohai was run, and gets saved to the Chef Server. It is also used in the Knife "status" sub command.
Automatic Attribute Precedence
参考: no title
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'