boxes = [
{ :name => :default, :role => 'default', :ip => '10.11.12.13' },
{ :name => :stats, :role => 'stats', :ip => '10.11.12.14' },
{ :name => :something, :role => 'something', :ip => '10.11.12.15' },
{ :name => :jenkins, :role => 'jenkins', :ip => '10.11.12.16', :http_forward => 8080 },
{ :name => :buildagent, :role => 'buildagent', :ip => '10.11.12.17', :http_forward => 8080 },
{ :name => :something, :role => 'something', :ip => '10.11.12.18' }
]
Vagrant::Config.run do |config|
vm_default = proc do |cnf|
cnf.vm.box = "ubuntu-11.10-server-amd64-ruby1.9.3"
cnf.vm.box_url = "http://hostname/boxes/ubuntu-11.10-server-amd64-ruby1.9.3.box"
cnf.vm.customize ["modifyvm", :id, "--memory", 2048]
end
chef_default = proc do |chef|
chef.cookbooks_path = "cookbooks"
chef.roles_path = "roles"
end
boxes.each do |opts|
# Make a box!...
config.vm.define opts[:name] do |config|
vm_default.call(config)
config.vm.forward_port 80, opts[:http_forward] if opts[:http_forward]
config.vm.network :hostonly, opts[:ip]
config.vm.host_name = "%s.vm" % opts[:name].to_s
config.vm.share_folder opts[:share_folder] if opts[:share_folder]
config.vm.provision :chef_solo do |chef|
chef_default.call(chef)
chef.add_role opts[:role].to_s
end
end
end
end