Created
November 4, 2011 23:29
-
-
Save cwholt/1340782 to your computer and use it in GitHub Desktop.
chef script to get all ipv4 address from all nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addresses = Array.new | |
search(:node).each do |n| | |
n[:network][:interfaces].each do |eth,eth_config| | |
next unless eth_config[:addresses] | |
eth_config[:addresses].each do |address,details| | |
addresses << address if details[:family] == "inet" && address != "127.0.0.1" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment