Information Technology Reference
In-Depth Information
"encapsulation": "Loopback",
"addresses": {
"127.0.0.1": {
"family": "inet",
"prefixlen": "8",
"netmask": "255.0.0.0",
"scope": "Node"
},
...
--More--
As you can see,
ohai
collects a lot of information about the current state of the computer:
networking configuration, CPU state, operating system type and version, memory consump-
tion, and much, much more.
As an example, let's take a look at this subset of the information generated by
ohai
. As you
can see in the following,
ohai
collects the node's IP address, MAC address, OS information,
hostname, and even that we are running in a virtualized guest:
{
.
.
.
"ipaddress"
:
"10.0.2.15"
,
"macaddress"
:
"08:00:27:1C:AD:B6"
,
.
.
.
"os"
:
"linux"
,
"os_version"
:
"2.6.32-431.el6.x86_64"
,
"platform"
:
"centos"
,
"platform_version"
:
"6.5"
,
"platform_family"
:
"rhel"
,
.
.
.
"virtualization"
: {
"system"
:
"vbox"
,
"role"
:
"guest"
}
.
.
.
"hostname"
:
"default-centos65"
.
.
.
}
In the next section, we'll access the information collected by
ohai
in our Chef code. Let's
learn more about how the information gets into Chef and how we can refer to this informa-
tion in our code.