Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

simple example of using virtualbox

View fog_virtualbox.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
require 'fog'
 
compute = Fog::Compute.new(:provider => 'VirtualBox')
 
server = compute.servers.create(:name => 'lucid', :os => 'Ubuntu')
 
medium = compute.mediums.create(:device_type => :hard_disk, :location => '/Users/geemus/geemus/virtualbox_poc/lucid.vmdk', :read_only => false)
 
storage_controller = server.storage_controllers.create(:bus => :sata, :name => 'sata')
storage_controller.attach(medium, 0)
 
network_adapter = server.network_adapters.first
network_adapter.mac_address = '080027D8E375'
network_adapter.save
 
nat_driver = network_adapter.nat_driver
nat_driver.redirects.create(:guest_port => 22, :host_port => 2222)
 
server.start
 
Formatador.display('Press return to shutdown/cleanup...')
STDIN.getc
 
server.destroy
 
medium.destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.