Hello
Understood. It’s very helpful hint. I will check the ohai output again and also custom plugin.
Thank you.
— idzzy
On July 11, 2014 at 1:28:09 PM, DV (
">
) wrote:
Maybe instead of relying on node[:ipaddress] you can
rely on node[:network][:interfaces][:eth0][:addresses] hash. It has
all the network info you may need. To get the IPv4 address you need
to check for value of "family":
node[:network][:interfaces][:eth0][:addresses].each do
|addr|
if addr[:family] == "inet"
return addr # not sure if this var contains
actual value..
end
end
Here's relevant section from ohai output:
"network": {
"interfaces": {
"eth0": {
"type": "eth",
"number": "0",
"mtu": "1500",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"encapsulation": "Ethernet",
"addresses": {
"06:84:8E:00:1D:A6":
{
"family":
"lladdr"
},
"10.190.34.22": {
"family":
"inet",
"prefixlen":
"23",
"netmask":
"255.255.254.0",
"broadcast":
"10.190.35.255",
"scope":
"Global"
},
"fe80::484:8eff:fe00:1da6":
{
"family":
"inet6",
"prefixlen":
"64",
"scope":
"Link"
}
|