Skip to content

Instantly share code, notes, and snippets.

@t9md
Created July 27, 2011 05:36
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save t9md/1108747 to your computer and use it in GitHub Desktop.
Save t9md/1108747 to your computer and use it in GitHub Desktop.
$hosts_table = {
:dbm => "192.168.86.101",
:app1 => "192.168.86.102",
:app2 => "192.168.86.103",
:lb => "192.168.86.104",
}
def bootstrap(config, host)
config.vm.box = "lucid64"
config.vm.network $hosts_table[host]
hostname = host.to_s
config.vm.customize { |v| v.name = hostname ; v.memory_size = 1024 }
config.vm.provision :chef_solo do |chef|
chef.run_list = [ "recipe[vagrant_main]" ]
chef.json = {
:ssh_pubkey => File.read(File.expand_path("~/.ssh/id_rsa.pub")),
:my_hostname => hostname,
:my_fqdn => "#{hostname}.example.com",
:my_gateway => "192.168.86.1"
}
end
end
Vagrant::Config.run do |config|
# dbm
config.vm.define(:dbm){ |c| bootstrap(c, :dbm) }
# app1 with db migration and load default data
config.vm.define(:app1){ |c| bootstrap(c, :app1) }
# app2 with db migration and load default data
config.vm.define(:app2){ |c| bootstrap(c, :app2) }
# lb with db migration and load default data
config.vm.define(:lb){ |c| bootstrap(c, :lb) }
end
# vim: ft=ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment