Multiple providers in a single vagrant file?

后端 未结 7 1370
一整个雨季
一整个雨季 2021-01-18 01:50

I\'ve got a vagrant file that builds a local VM. I want to add the EC2 provider and have the option of either provisioning a local VM or one on EC2.

Can I create co

7条回答
  •  醉梦人生
    2021-01-18 02:10

    add box for each provider

    > vagrant box add precise64 http://file.vagrantup.com/precise64.box
    > vagrant box add precise64 http://file.vagrantup.com/precise64_vmware_fusion.box
    

    and your Vagrantfile should look like

    Vagrant.configure(2) do |config|
      config.vm.box="precise64"
    
      config.vm.provider "virtualbox" do |v|
        v.customize ["modifyvm", :id, "--memory", "2048"]
      end
    
      config.vm.provider "vmware_fusion" do |v|
        v.vmx["memsize"] = "2048"
      end
    end
    

    then create on each provider using following commands

    > vagrant up --provider=virtualbox
    > vagrant up --provider=vmware_fusion
    

提交回复
热议问题