Guest User

Untitled

a guest
Apr 5th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'rubygems'
  4. require 'pp'
  5. require 'fog'
  6. require 'highline/import'
  7.  
  8. def get_password(prompt="Enter password:")
  9. ask(prompt) {|q| q.echo = false}
  10. end
  11.  
  12. #user = gets.chomp
  13. pass = get_password()
  14.  
  15. credentials = {
  16. :provider => "vsphere",
  17. :vsphere_username => "user.name",
  18. :vsphere_password => pass,
  19. :vsphere_server => "my_vcserver",
  20. :vsphere_ssl => true,
  21. :vsphere_expected_pubkey_hash => "my_hash",
  22. :vsphere_rev => "4.0"
  23. }
  24. connection = Fog::Compute.new(credentials)
  25.  
  26. # MUST BE Ruby v 1.9 to use this hash style
  27. vms = connection.list_virtual_machines(datacenter: 'my_dc', folder: 'my_folder')
  28. pp vms
Add Comment
Please, Sign In to add comment