Vagrant.configure("2") do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.define :YOURNAMEHERE do |t|
end
end
终端输出:
$ vagrant status
Current machine states:
YOURNAMEHERE not created (virtualbox)
Vagrant.configure('2') do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provider :virtualbox do |vb|
vb.name = "foohost"
end
end
Vagrant.configure('2') do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.define "foohost"
config.vm.provider :virtualbox do |vb|
vb.name = "barhost"
end
end
# -*- mode: ruby -*-
require 'getoptlong'
opts = GetoptLong.new(
[ '--vm-name', GetoptLong::OPTIONAL_ARGUMENT ],
)
vm_name = ENV['VM_NAME'] || 'default'
begin
opts.each do |opt, arg|
case opt
when '--vm-name'
vm_name = arg
end
end
rescue
end
Vagrant.configure(2) do |config|
config.vm.define vm_name
config.vm.provider "virtualbox" do |vbox, override|
override.vm.box = "ubuntu/wily64"
# ...
end
# ...
end