Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
Created November 25, 2012 18:57
Show Gist options
  • Save mrrooijen/4144799 to your computer and use it in GitHub Desktop.
Save mrrooijen/4144799 to your computer and use it in GitHub Desktop.
Example of running multiple VM's using a single Vagrantfile.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "base"
config.vm.customize ["modifyvm", :id, "--memory", 1024]
config.vm.define :haproxy do |haproxy|
haproxy.vm.forward_port 80, 8000
haproxy.vm.network :hostonly, "192.168.1.10"
end
config.vm.define :appserver1 do |app|
app.vm.forward_port 80, 8001
app.vm.network :hostonly, "192.168.1.11"
end
config.vm.define :appserver2 do |app|
app.vm.forward_port 80, 8002
app.vm.network :hostonly, "192.168.1.12"
end
config.vm.define :appserver3 do |app|
app.vm.forward_port 80, 8003
app.vm.network :hostonly, "192.168.1.13"
end
config.vm.define :db do |db|
# db.vm.forward_port xxx, xxxx
db.vm.network :hostonly, "192.168.1.14"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment