Should multiple machines declared in the Vagrantfile be based on the same base field?
From the documentation, you can refer to the need to use multiple environments to reproduce your production (e.g. one db machine, one web machine, etc.):
Vagrant.configure("2") do |config|
config.vm.define "web" do |web|
web.vm.box = "apache"
end
config.vm.define "db" do |db|
db.vm.box = "mysql"
end
end
This is well explained, but I also understand that they will all be based on the same field: eg. ubuntu-1404 for example.
What happens if you need the db box to be on oracle linux like webbox on ubuntu? Appart from creating two directories with two Vagrantfile I don't see any other option.
Has anyone ever done this and how?
source to share
No, the boxes can be different. The example you showed (on the Multi-Machine doc page is very confusing because it is not clear which "apache" and "mysql" refer to.
You can set *.vm.box
to actual field names. For example, finding a couple of boxes from Vagrant cloud might change your example Vagrantfile to:
Vagrant.configure("2") do |config|
config.vm.define "web" do |web|
web.vm.box = "hashicorp/precise64"
end
config.vm.define "db" do |db|
db.vm.box = "box-cutter/oel65"
end
end
source to share