Merge pull request #9 from bodepd/feature/master/add_build_files

Feature/master/add build files
This commit is contained in:
Dan Bode
2011-06-30 13:17:38 -07:00
6 changed files with 103 additions and 23 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ facter
puppet
bashrc
.vagrant
graphs/*

77
Rakefile Normal file
View File

@@ -0,0 +1,77 @@
require 'vagrant'
env=Vagrant::Environment.new(:cwd => File.dirname(__FILE__))
# this captures the regular output to stdout
env.ui = Vagrant::UI::Shell.new(env, Thor::Base.shell.new)
env.load!
# all of the instance to build out for multi-node
instances = [
:db,
:rabbitmq,
:glance,
:controller,
:compute
]
namespace :build do
desc 'build out 5 node openstack cluster'
task :multi do
instance.each do |instance|
build(instance, env)
end
end
desc 'build out openstack on one node'
task :all do
build(:all, env)
end
end
# bring vagrant vm with image name up
def build(instance, env)
unless vm = env.vms[instance]
puts "invalid VM: #{instance}"
else
if vm.created?
puts "VM: #{instance} was already created"
else
# be very fault tolerant :)
begin
# this will always fail
vm.up(:provision => true)
rescue Exception => e
puts e.class
puts e
end
end
end
end
namespace :test do
desc 'test multi-node installation'
task :multi do
{:glance => ['sudo /vagrant/ext/glance.sh'],
:controller => ['sudo /vagrant/ext/nova.sh'],
}.each do |instance, commands|
test(instance, commands, env)
end
end
desc 'test single node installation'
task :all do
test(:all, ['sudo /vagrant/ext/glance.sh', 'sudo /vagrant/ext/nova.sh'], env)
end
end
def test(instance, commands, env)
unless vm = env.vms[instance]
puts "invalid VM: #{instance}"
else
puts "testing :#{instance}"
vm.ssh.execute do |ssh|
commands.each do |c|
#puts ssh.methods - Object.methods
puts ssh.exec!(c)
end
end
end
end

8
Vagrantfile vendored
View File

@@ -27,10 +27,10 @@ Vagrant::Config.run do |config|
pm.vm.forward_port('ssh', 22, ssh_forward, :auto => true)
# hard-coding this b/c it is important
pm.vm.network("#{net_base}.10")
pm.vm.provision :puppet do |puppet|
puppet.manifest_file = "master.pp"
puppet.options = ["--certname","puppetmaster", '--modulepath', '/vagrant/modules']
end
#pm.vm.provision :puppet do |puppet|
# puppet.manifest_file = "master.pp"
# puppet.options = ["--certname","puppetmaster", '--modulepath', '/vagrant/modules']
#end
end
config.vm.define :all do |all|

19
ext/test.sh → ext/glance.sh Normal file → Executable file
View File

@@ -1,24 +1,7 @@
#!/bin/bash
# Extract creds
cd ~
sudo nova-manage project zipfile nova novaadmin
unzip nova.zip
source novarc
euca-add-keypair openstack > ~/cert.pem
# Add images to glance and index
glance add name=ramdisk disk_format=ari container_format=ari is_public=True < /vagrant/images/lucid_ami/initrd.img-2.6.32-23-server
glance add name=kernel disk_format=aki container_format=aki is_public=True < /vagrant/images/lucid_ami/vmlinuz-2.6.32-23-server
glance add name=lucid_ami disk_format=ami container_format=ami is_public=True ramdisk_id=1 kernel_id=2 < /vagrant/images/lucid_ami/ubuntu-lucid.img
glance index
# List
nova flavor-list
nova image-list
# Run instance
euca-run-instances ami-00000003 -k openstack -t m1.tiny
euca-describe-instances
echo 'check the status of your VM with euca-describe-instances'
echo 'when it is in the running state, verify that you can login'
echo 'using ssh -i ~/cert.pem root@ip.address'

19
ext/nova.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# Extract creds
cd ~
sudo nova-manage project zipfile nova novaadmin
unzip nova.zip
source novarc
euca-add-keypair openstack > ~/cert.pem
# List
nova flavor-list
nova image-list
# Run instance
euca-run-instances ami-00000003 -k openstack -t m1.tiny
euca-describe-instances
echo 'log into your controller VM'
echo 'check the status of your VM with euca-describe-instances'
echo 'when it is in the running state, verify that you can login'
echo 'using ssh -i ~/cert.pem root@ip.address'

View File

@@ -77,7 +77,7 @@ node compute {
class { "nova":
verbose => $verbose,
sql_connection => "mysql://${db_username}:${db_password}@${db_host}/${db_name}",
image_service => $image_service,
image_service => 'nova.image.glance.GlanceImageService',
glance_api_servers => $glance_api_servers,
glance_host => $glance_host,
glance_port => $glance_port,