Skip to content

Instantly share code, notes, and snippets.

@ajohnstone
Created October 24, 2013 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajohnstone/7136882 to your computer and use it in GitHub Desktop.
Save ajohnstone/7136882 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "ubuntu_server_12_10_amd64"
config.vm.box_url = 'http://goo.gl/8kWkm'
nodes = {
'esb' => {
:hostname => '01-esb.photobox.com',
:ip => '192.168.100.10',
:forwards => {
80 => 10080,
443 => 10443,
},
:run_list => [
"recipe[mule::default]",
]
},
}
nodes.each do |name,node_config|
config.vm.define name do |vm_config|
vm_config.vm.host_name = node_config[:hostname] if node_config[:hostname]
vm_config.vm.network :hostonly, node_config[:ip] if node_config[:ip]
vm_config.vm.box = node_config[:box] if node_config[:box]
if node_config[:forwards]
node_config[:forwards].each do |from,to|
vm_config.vm.forward_port from, to
end
end
customize = ["modifyvm", :id] + (node_config[:modify] || [])
if ! customize.include?("--name")
# This adds the name of the box to the vm-name in
# VirtualBox so we can identify it easily in the GUI.
customize += [ "--name",
File.basename(File.dirname(__FILE__)) +
"-#{name}" + "_#{Time.now.to_i}"
]
end
vm_config.vm.customize customize
vm_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
# Turn on verbose Chef logging if necessary
chef.log_level = :debug
chef.run_list = node_config[:run_list] if node_config[:run_list]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment