Created
October 8, 2014 23:34
-
-
Save pcarrier/c2230ae3c02517db7195 to your computer and use it in GitHub Desktop.
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
# IPv4 address of eth0, assuming eth0 has only one IPv4 address.. | |
require 'ohai' | |
sys = ::Ohai::System.new | |
sys.all_plugins | |
node = sys.data | |
node['network']['interfaces']['eth0']['addresses'].find {|k,v| v['family'] == 'inet'}.first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment