vagrant配置多个虚拟机

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


Tagged , , . Bookmark the permalink.

Comments are closed.