Skip to content

Instantly share code, notes, and snippets.

@lorentzca
Created October 5, 2015 06:03
Show Gist options
  • Save lorentzca/e708094cb10ab7b08ba3 to your computer and use it in GitHub Desktop.
Save lorentzca/e708094cb10ab7b08ba3 to your computer and use it in GitHub Desktop.
Ohai plug-in to get the public ip address
Ohai.plugin(:PublicIp) do
provides 'public_ip'
collect_data do
public_ip Mash.new
public_ip[:public_ip] = `curl -s http://whatismyip.akamai.com/`
end
end
@lorentzca
Copy link
Author

Usage

$ ohai public_ip
{
  "public_ip": "1.2.3.4"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment