Created
February 1, 2013 17:01
-
-
Save fishnix/4692582 to your computer and use it in GitHub Desktop.
messing with rbvmomi
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 '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