Skip to content

Instantly share code, notes, and snippets.

@Sauraus
Created July 11, 2013 18:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sauraus/5977921 to your computer and use it in GitHub Desktop.
Save Sauraus/5977921 to your computer and use it in GitHub Desktop.
Example Multi OS & Multi guest VagrantFile
Vagrant.require_plugin "vagrant-windows"
win2k8_servers = {
:www => {
:hostname => "www",
:rdp_port => 3390,
:winrm_port => 5986
},
:api => {
:hostname => "api",
:rdp_port => 3391,
:winrm_port => 5987
},
:wcf => {
:hostname => "wcf",
:rdp_port => 3393,
:winrm_port => 5988
}
}
linux_servers = {
:mc => {
:hostname => "mc"
},
:solr => {
:hostname => "solr"
},
:es => {
:hostname => "es"
}
}
Vagrant.configure("2") do |global_config|
global_config.vm.network :hostonly, :type => :dhcp, :adapter => 2, :ip => "192.168.64.1", :auto_config => false
win2k8_servers.each_pair do |name, options|
global_config.vm.define name do |config|
rdp_port = options[:rdp_port]
winrm_port = options[:winrm_port]
config.vm.guest = :windows
config.vm.box_url = "./windows-2008R2SP1VL-serverweb-amd64.box"
config.vm.box = "windows-2008R2SP1VL-serverweb-amd64"
# Max time to wait for the guest to shutdown
config.windows.halt_timeout = 15
# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.network :forwarded_port, guest: 3389, host: rdp_port
config.vm.network :forwarded_port, guest: 5985, host: winrm_port
config.vm.hostname = options[:hostname]
end
end
linux_servers.each_pair do |name, options|
global_config.vm.define name do |config|
config.vm.guest = :linux
config.vm.box_url = "./centos63x64.box"
config.vm.box = "centos63x64"
# Admin user name
config.ssh.username = "vagrant"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment