Skip to content

Instantly share code, notes, and snippets.

@bodepd
Created January 24, 2012 23:49
Show Gist options
  • Save bodepd/1673561 to your computer and use it in GitHub Desktop.
Save bodepd/1673561 to your computer and use it in GitHub Desktop.
This is my example vagrant file
Vagrant::Config.run do |config|
#vagrant config file for building out multi-node with Puppet :)
box = 'natty'
remote_url_base = ENV['REMOTE_VAGRANT_STORE']
config.vm.box = "#{box}"
#config.ssh.forwarded_port_key = "ssh"
ssh_forward = 2222
config.vm.box = "#{box}"
config.vm.box_url = "http://faro.puppetlabs.lan/vagrant/#{box}.vbox"
net_base = "172.21.0"
use_master = false
path_default = use_master ? 'scripts/run-master.sh' : 'scripts/run.sh'
vms = {
# build a puppetmaster with storedconfigs set up!
:puppetmaster => {
:ip => "#{net_base}.10",
# always use puppet apply to build the master
:path => 'scripts/run.sh'
},
# install mysql, rabbitmq, nova, and glance on a single node
:all => {:ip => "#{net_base}.11"},
# set up a mysql db
:db => {:ip => "#{net_base}.12"},
:rabbitmq => {:ip => "#{net_base}.13"},
:controller => {:ip => "#{net_base}.14"},
# install a nova compute instance
:compute => {:ip => "#{net_base}.15"},
# install a glance server
:glance => {:ip => "#{net_base}.16"},
# install a keystone server
:keystone => {:ip => "#{net_base}.17"},
# install a keystone dev instance
:keystone_dev => {:ip => "#{net_base}.18"},
# install a machine with no role installed
:blank => {:ip => "#{net_base}.201"},
# install all swift components on a single node
:swift_all => {
:ip => "#{net_base}.100",
:path => 'scripts/run-swift-multi.sh'
},
:swift_storage_1 => {
:ip => "#{net_base}.101",
:path => 'scripts/run-swift-multi.sh'
},
:swift_storage_2 => {
:ip => "#{net_base}.102",
:path => 'scripts/run-swift-multi.sh'
},
:swift_storage_3 => {
:ip => "#{net_base}.103",
:path => 'scripts/run-swift-multi.sh'
},
:swift_ringbuilder => {
:ip => "#{net_base}.104",
:path => 'scripts/run-swift-multi.sh'
},
:swift_proxy => {
:ip => "#{net_base}.105",
:path => 'scripts/run-swift-multi.sh'
}
}.each do |name, attrs|
config.vm.define name do |config|
ssh_forward = ssh_forward + 1
config.vm.forward_port(22, ssh_forward, :auto => true)
config.vm.network(:hostonly, attrs[:ip])
config.vm.customize([
"modifyvm", :id,
'--memory', attrs[:memory] || '768',
'--name', name.to_s
])
path = attrs[:path] || path_default
config.vm.provision :shell, :path => path do |shell|
shell.args = name.to_s
end
end
end
end
# vim:ft=ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment