Skip to content

Instantly share code, notes, and snippets.

@complexsplit
Created September 3, 2013 01:58
Show Gist options
  • Save complexsplit/6418946 to your computer and use it in GitHub Desktop.
Save complexsplit/6418946 to your computer and use it in GitHub Desktop.
Creating a VM with Fog & vSphere
require 'rubygems'
require 'fog'
credentials = {
:provider => "vsphere",
:vsphere_username => "root",
:vsphere_password => "vmware",
:vsphere_server => "vcenter.home",
:vsphere_ssl => true,
:vsphere_expected_pubkey_hash => "661x0bb1bd68fcaa1a6e0k512003fe4b90e7ba41b7f67b495f4a315bd5614dz7",
:vsphere_rev => "5.0"
}
connection = Fog::Compute.new(credentials)
connection.create_vm({:name => 'vm-name', :guest_id => 'blah', :cpus => 2, :memory_mb => 1024, :resource_pool => 'respool', :path => '/vmfs/folder', :datacenter => 'datacenter', :volumes => {}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment