vagrant file 模板




# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.require_version ">= 1.6.0"

boxes = [
    {
        :name => "cs7-1",
        :eth1 => "10.0.1.15",
        :mem => "512",
        :cpu => "1"
    },
	 {
        :name => "cs7-2",
        :eth1 => "10.0.1.16",
        :mem => "512",
        :cpu => "1"
    },
	 {
        :name => "cs7-3",
        :eth1 => "10.0.1.17",
        :mem => "512",
        :cpu => "1"
    },
   
]

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 "vmware_fusion" do |v|
          v.vmx["memsize"] = opts[:mem]
          v.vmx["numvcpus"] = opts[:cpu]
        end

        config.vm.provider "virtualbox" do |v|
          v.customize ["modifyvm", :id, "--memory", opts[:mem]]
          v.customize ["modifyvm", :id, "--cpus", opts[:cpu]]
        end

        config.vm.network :private_network, ip: opts[:eth1]
		config.vm.boot_timeout = 100
      end
  end

  #config.vm.synced_folder "./labs", "/home/vagrant/labs"
  config.vm.provision "shell", privileged: true, path: "./setup.sh"

end
posted @ 2020-09-09 16:23  前海渔文乐  阅读(125)  评论(0编辑  收藏  举报