- From: Chaim Keren-Tzion <
>
- To: chef <
>
- Subject: [chef] How to get an array of all IP addresses on a node?
- Date: Tue, 20 Dec 2011 14:51:37 +0200
I've been using the following to get an array of all IP addresses on a node:
node.network.interfaces.map { |p, f| f[:addresses].keys }.flatten
Which I then clean up with the following to get rid of the mac addresses:
node.network.interfaces.map { |p, f| f[:addresses].keys }.flatten.delete_if{|x| x =~ /(.*):(.*)/ }
It works on CentOS 5 hosts and vserver guests on CentOS 5 hosts however it does not work on KVM guests or on RedHat 4 hosts. The output on those nodes is different so they can't use the "keys" method.
Anyone know of any reliable and consistent ways to get a list of all IP Addresses on a node?
Thanks,
Chaim
- [chef] How to get an array of all IP addresses on a node?, Chaim Keren-Tzion, 12/20/2011
Archive powered by MHonArc 2.6.16.