Skip to content

Instantly share code, notes, and snippets.

@fishnix
Created February 1, 2013 17:01
Show Gist options
  • Select an option

  • Save fishnix/4692582 to your computer and use it in GitHub Desktop.

Select an option

Save fishnix/4692582 to your computer and use it in GitHub Desktop.
messing with rbvmomi
require 'rbvmomi'
require 'awesome_print'
datacenter = 'SCI_DC_01'
vm_name = 'vm-vslabapp-06'
vim = RbVmomi::VIM.connect host: '192.168.111.41', user: 'XXXXXXXXX', password: 'XXXXXXX', insecure: true
dc = vim.serviceInstance.find_datacenter(datacenter) or abort "datacenter not found"
vm = dc.find_vm("VRM/#{vm_name}") or abort "VM not found"
ip = vm.guest.ipAddress.nil? ? "Unknown" : vm.guest.ipAddress
puts "#{vm} is a VM , with name #{vm.name} and IP #{ip}"
puts " Annotations:"
ap vm.customValue
ap vm.config.annotation
ap vm.summary.customValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment