vagrant多虚拟机配置

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

   config.vm.provider "virtualbox" do |vb|
     vb.gui = false
     vb.customize ["modifyvm", :id, "--memory", "512"]
   end

  config.vm.provision "shell", inline: "echo Hello"

  config.vm.define "dev", primary: true do |dev|
    dev.vm.box = "centos-aliyun-6.5"
    dev.vm.network :private_network, ip: "192.168.1.100"
    dev.vm.provision "shell", inline: "echo dev"
    dev.vm.synced_folder "d:/project", "/var/www"
  end

  config.vm.define "db1", autostart: false do |db1|
    db1.vm.box = "centos-aliyun-6.5"
    db1.vm.network :private_network, ip: "192.168.1.101"
    db1.vm.provision "shell", inline: "echo db1"
  end

  config.vm.define "db2", autostart: false do |db2|
    db2.vm.box = "centos-aliyun-6.5"
    db2.vm.network :private_network, ip: "192.168.1.102"
    db2.vm.provision "shell", inline: "echo db2"
  end

  config.vm.define "db3", autostart: false do |db3|
    db3.vm.box = "centos-aliyun-6.5"
    db3.vm.network :private_network, ip: "192.168.1.103"
    db3.vm.provision "shell", inline: "echo db2"
  end

end

发表评论