I am looking to extract one IP out of four IPs assigned to a server.
Example: I have many servers with 4 ethernet cards per host and 10.0.10.0/24 10.0.20.0/24 10.0.30.0/24 10.0.40.0/24 assigned to the NICs. I am able to pull IP addresses assigned to specific NIC using
eth0 is <%= node[:network][:interfaces][:eth0][:addresses].detect{|k,v| v[:family] == “inet” }.first %>
It was easier to pull addresses if the addresses were assigned in an order - like eth0 = 10.0.10.0/24, eth1 = 10.0.20.0/24 etc. However in this case, the IPs are not assigned in an order and I am stuck with extracting the IP of my choice.
Could someone please help.
Thanks,