Created
February 13, 2018 23:59
-
-
Save futoase/6ed1b0648c9ae079f8bb372929435082 to your computer and use it in GitHub Desktop.
network-address-digital-ocean-instance
This file contains hidden or 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
require 'droplet_kit' | |
# get access token from https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-api-v2 | |
# export DIGITAL_OCEAN_TOKEN=XXXXXXXXXXXX | |
client = DropletKit::Client.new(access_token: ENV['DIGITAL_OCEAN_TOKEN']) | |
client.droplets.all().map do |i| | |
i.networks.each do |network| | |
if network&.first&.ip_address | |
puts "#{network&.first&.ip_address}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment