Added stuff related to my testing of multi-node

This commit is contained in:
Dan Bode
2011-06-22 19:09:43 -07:00
parent 076a3f3ae0
commit 75851ad65a
11 changed files with 185 additions and 12 deletions

42
Vagrantfile vendored
View File

@@ -1,7 +1,7 @@
Vagrant::Config.run do |config|
#vagrant config file for building out multi-node with Puppet :)
box = 'natty'
box = 'natty_openstack'
remote_url_base = ENV['REMOTE_VAGRANT_STORE']
config.vm.box = "#{box}"
@@ -23,8 +23,7 @@ Vagrant::Config.run do |config|
# the master runs apply to configure itself
config.vm.define :puppetmaster do |pm|
pm.vm.box = "natty"
pm.vm.forward_port("http", 8140, 8141)
pm.vm.forward_port("http", 8140, 8140)
ssh_forward = ssh_forward + 1
pm.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
# hard-coding this b/c it is important
@@ -36,20 +35,43 @@ Vagrant::Config.run do |config|
end
config.vm.define :all do |all|
all.vm.box = "natty"
ssh_forward = ssh_forward + 1
all.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
all.vm.network("#{net_base}.11")
all.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "all.pp"
puppet.options = ['--certname', 'all', '--modulepath', '/vagrant/modules']
end
all.vm.provision :shell, :path => 'scripts/run-all.sh'
end
config.vm.define :database do |mysql|
config.vm.define :db do |mysql|
ssh_forward = ssh_forward + 1
mysql.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
mysql.vm.network("#{net_base}.12")
mysql.vm.provision :shell, :path => 'scripts/run-db.sh'
end
config.vm.define :rabbitmq do |rabbit|
ssh_forward = ssh_forward + 1
rabbit.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
rabbit.vm.network("#{net_base}.13")
rabbit.vm.provision :shell, :path => 'scripts/run-rabbit.sh'
end
config.vm.define :controller do |controller|
ssh_forward = ssh_forward + 1
controller.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
controller.vm.network("#{net_base}.14")
controller.vm.provision :shell, :path => 'scripts/run-controller.sh'
end
config.vm.define :compute do |compute|
ssh_forward = ssh_forward + 1
compute.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
compute.vm.network("#{net_base}.15")
compute.vm.provision :shell, :path => 'scripts/run-compute.sh'
end
config.vm.define :glance do |glance|
ssh_forward = ssh_forward + 1
glance.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
glance.vm.network("#{net_base}.16")
glance.vm.provision :shell, :path => 'scripts/run-glance.sh'
end
end
# vim:ft=ruby

View File

@@ -1,7 +1,6 @@
#
# This manifest installs all of the nova
# components on one node.
import 'hosts.pp'
resources { 'nova_config':
purge => true,
}

View File

@@ -5,4 +5,18 @@ host { 'puppetmaster':
host { 'all':
ip => '172.20.0.11',
}
host { 'db':
ip => '172.20.0.12'
}
host { 'rabbitmq':
ip => '172.20.0.13',
}
host { 'controller':
ip => '172.20.0.14',
}
host { 'compute':
ip => '172.20.0.15',
}
host { 'glance':
ip => '172.20.0.16',
}

121
manifests/split.pp Normal file
View File

@@ -0,0 +1,121 @@
#
# This manifest installs all of the nova
# components on one node.
#
resources { 'nova_config':
purge => true,
}
# db settings
$db_password = 'password',
$db_name = 'nova',
$db_user = 'nova',
# this needs to be determined magically
$db_host = 'localhost',
# rabbit settings
$rabbit_password = 'rabbitpassword',
$rabbit_port = '5672',
$rabbit_userid = 'rabbit_user',
$rabbit_virtual_host = '/',
# this needs to be determined magically
$rabbit_host = 'localhost',
# glance settings
$image_service = 'nova.image.glance.GlanceImageService',
# this needs to be determined magically
$glance_host = 'localhost',
$glance_port = '9292',
# this is required for vagrant
$libvirt_type = 'qemu'
# bridge information
$flat_network_bridge = 'br100',
$flat_network_bridge_ip = '11.0.0.1',
$flat_network_bridge_netmask = '255.255.255.0',
$admin_user = 'nova_admin'
$project_name = 'nova_project'
# we need to be able to search for the following hosts:
# rabbit_host
# glance_host
# db_host
# api server
# initially going to install nova on one machine
node /nova/ {
class { "nova":
verbose => $verbose,
sql_connection => "mysql://${db_user}:${db_password}@${db_host}/${db_name}",
image_service => $image_service,
glance_host => $glance_host,
glance_port => $glance_port,
rabbit_host => $rabbit_host,
rabbit_port => $rabbit_port,
rabbit_userid => $rabbit_userid,
rabbit_password => $rabbit_password,
rabbit_virtual_host => $rabbit_virtual_host,
}
class { "nova::api": enabled => true }
class { "nova::compute":
api_server => $ipaddress,
libvirt_type => $libvirt_type,
enabled => true,
}
class { "nova::network::flat":
enabled => true,
flat_network_bridge => $flat_network_bridge,
flat_network_bridge_ip => $flat_network_bridge_ip,
flat_network_bridge_netmask => $flat_network_bridge_netmask,
}
nova::manage::admin { $admin_user: }
nova::manage::project { $project_name:
owner => $admin_user,
}
nova::manage::network { "${project_name}-net-${network}":
network => $nova_network,
available_ips => $available_ips,
require => Nova::Manage::Project[$project_name],
}
}
node /puppetmaster/ {
}
node /db/ {
class { 'mysql::server': }
class { 'nova::db':
# pass in db config as params
password => $db_password,
name => $db_name,
user => $db_user,
host => $db_host,
}
}
node /rabbit/ {
class { 'nova::rabbitmq':
port => $rabbit_port,
userid => $rabbit_userid,
password => $rabbit_password,
virtual_host => $rabbit_virtual_host,
require => Host[$hostname],
}
}
node /glance/ {
# set up glance server
class { 'glance::api':
swift_store_user => 'foo_user',
swift_store_key => 'foo_pass',
}
class { 'glance::registry': }
}

2
scripts/run-all.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
bash /vagrant/scripts/run.sh all

2
scripts/run-compute.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
bash /vagrant/scripts/run.sh compute

3
scripts/run-controller.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
bash /vagrant/scripts/run.sh controller

2
scripts/run-db.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
bash /vagrant/scripts/run.sh db

2
scripts/run-glance.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
bash /vagrant/scripts/run.sh glance

3
scripts/run-rabbitmq.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
bash /vagrant/scripts/run.sh rabbitmq

3
scripts/run.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
puppet apply /vagrant/manifests/hosts.pp
puppet apply --certname $1 /vagrant/manifests/site.pp --modulepath /vagrant/modules