Skip to content

Instantly share code, notes, and snippets.

@alexmuller
Created July 9, 2015 13:13
Show Gist options
  • Save alexmuller/7a1e4537e7815710e505 to your computer and use it in GitHub Desktop.
Save alexmuller/7a1e4537e7815710e505 to your computer and use it in GitHub Desktop.
require 'yaml'
vdcs = ['api', 'backend', 'frontend', 'management', 'redirector', 'router']
providers = ['production_skyscape', 'staging_carrenza']
parsed = []
vdcs.each do |vdc|
providers.each do |provider|
vapps = YAML.load_file("~/govuk/govuk-provisioning/vcloud-launcher/#{provider}/#{vdc}.yaml")['vapps']
vapps.each do |vapp|
parsed << {provider: provider, vapp: vapp['name'], ip: vapp['vm']['network_connections'][0]['ip_address']}
end
end
end
parsed.group_by { |x| x[:vapp] }.each do |k, providers|
output = k.ljust(40)
providers.each do |p|
output += "#{p[:ip].ljust(20)} "
end
if providers[0][:ip].split('.')[3] != providers[1][:ip].split('.')[3]
output += "Final octet of IP does not match"
end
puts output
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment