Multiple providers in a single vagrant file?

后端 未结 7 1372
一整个雨季
一整个雨季 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:31

    Yes, you can specify multiple machines by using the config.vm.define method call, for example:

    Vagrant.configure("2") do |config|
      config.vm.provision "shell", inline: "echo Hello"
    
      config.vm.define "web" do |web|
        web.vm.box = "apache"
      end
    
      config.vm.define "db" do |db|
        db.vm.box = "mysql"
      end
    end
    

    See: Defining multiple machines at Vagranup Docs and Providers

    0 讨论(0)
提交回复
热议问题