vagrant配置多个虚拟机

2018-04-28 11:30:14 浏览数 (1)

代码语言:javascript复制
Vagrant.configure("2") do |config|
	vms = Array(1..5)
    vms.each do |i|
        config.vm.define "node-#{i}" do |node|
            node.vm.box = "ubuntu16.04"
			node.vm.hostname = "ubuntu16-04-#{i}"
            node.vm.box_check_update = false 
			node.vm.network "private_network", ip: "192.168.56.20#{i}"
            node.vm.synced_folder "E:/data", "/data"
			node.vm.provider "virtualbox" do |v|
				v.name = "ubuntu16.04_#{i}"
				v.memory = 4096 
				v.cpus = 4
			end
		end
    end
end

0 人点赞