Skip to content

Instantly share code, notes, and snippets.

@huskercane
Created July 29, 2014 20:16
Show Gist options
  • Select an option

  • Save huskercane/873ad18cbfcfa4668274 to your computer and use it in GitHub Desktop.

Select an option

Save huskercane/873ad18cbfcfa4668274 to your computer and use it in GitHub Desktop.
Use SoftLayer API to get password for a server created
require 'softlayer_api'
require 'pp'
softlayer_client = SoftLayer::Client.new()
account = SoftLayer::Account.account_for_client(softlayer_client)
servers = SoftLayer::VirtualServer.find_servers(:client => softlayer_client, :object_mask => "mask[id,primaryBackendIpAddress,primaryIpAddress, hostname, domain, operatingSystem[passwords]]")
details = servers.map do |server|
puts server['id'], server['primaryBackendIpAddress'], server['primaryIpAddress']
pp server['operatingSystem']['passwords']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment