Created
May 15, 2013 02:57
-
-
Save double-z/5581362 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment