Vagrantfile
boxes = [
{
:name => "u1",
:eth1 => "192.168.0.11",
:mem => "16384",
:cpu => "4"
},
{
:name => "u2",
:eth1 => "192.168.0.12",
:mem => "16384",
:cpu => "4"
},
{
:name => "u3",
:eth1 => "192.168.0.13",
:mem => "16384",
:cpu => "4"
}
]
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
boxes.each do |opts|
config.vm.define opts[:name] do |config|
config.vm.hostname = opts[:name]
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", opts[:mem]]
v.customize ["modifyvm", :id, "--cpus", opts[:cpu]]
v.customize ["modifyvm", :id, "--name", opts[:name]]
end
config.vm.network :public_network, ip: opts[:eth1]
end
end
end
假如空间不够用
vagrant virtualvox 磁盘扩容实践
网友评论