Add Redhat support

- move hosts.pp to setup/precise64.pp
- create a setup manifest for redhat
- do not use apache module for red hat
- allow config of vagrant based on ENV VAR
This commit is contained in:
Dan Bode
2012-11-05 22:46:53 -08:00
parent 386774ffd8
commit cac3fe554d
5 changed files with 88 additions and 26 deletions

25
Vagrantfile vendored
View File

@@ -1,7 +1,5 @@
Vagrant::Config.run do |config|
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
if ENV['OPENSTACK_GUI_MODE']
gui_mode = ENV['OPENSTACK_GUI_MODE'].to_bool
@@ -9,6 +7,20 @@ Vagrant::Config.run do |config|
gui_mode = true
end
if ENV['OPERATINGSYSTEM']
if ENV['OPERATINGSYSTEM'].downcase == 'redhat'
os_name = 'centos'
config.vm.box = 'centos'
config.vm.box_url = 'https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box'
else
raise(Exception, "undefined operatingsystem: #{ENV['OPERATINGSYSTEM']}")
end
else
os_name = 'precise64'
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
end
ssh_forward_port = 2244
[
@@ -106,12 +118,15 @@ Vagrant::Config.run do |config|
node_name = "#{name.gsub('_', '-')}-#{Time.now.strftime('%Y%m%d%m%s')}"
agent.vm.provision :shell, :inline => "apt-get update"
#agent.vm.provision :shell, :inline => "apt-get -y upgrade"
if os_name =~ /precise/
agent.vm.provision :shell, :inline => "apt-get update"
elsif os_name =~ /centos/
agent.vm.provision :shell, :inline => "yum clean all"
end
agent.vm.provision :puppet do |puppet|
puppet.manifests_path = 'manifests'
puppet.manifest_file = 'hosts.pp'
puppet.manifest_file = "setup/#{os_name}.pp"
puppet.module_path = 'modules'
puppet.options = ['--verbose', '--debug', '--show_diff', "--certname=#{node_name}"]
end

36
manifests/setup/centos.pp Normal file
View File

@@ -0,0 +1,36 @@
import 'hosts.pp'
file { '/etc/yum.repos.d':
ensure => directory,
}
file { '/tmp/setup_epel.sh':
content =>
'
#!/bin/bash
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -Uvh epel-release-6*.rpm'
}
exec { '/bin/bash /tmp/setup_epel.sh':
refreshonly => true,
subscribe => File['/tmp/setup_epel.sh']
}
ini_setting { 'enable_epel_testing':
path => '/etc/yum.repos.d/epel-testing.repo',
section => 'epel-testing',
setting => 'enabled',
value => '1',
ensure => present,
require => Exec['/bin/bash /tmp/setup_epel.sh'],
}
ini_setting { 'yum_proxy':
path => '/etc/yum.conf',
section => 'main',
setting => 'proxy',
value => 'http://172.16.0.1:3128',
ensure => present,
require => Exec['/bin/bash /tmp/setup_epel.sh'],
}

19
manifests/setup/hosts.pp Normal file
View File

@@ -0,0 +1,19 @@
#
# specify a connection to the hardcoded puppet master
#
host {
'puppet': ip => '172.16.0.2';
'openstackcontroller': ip => '172.16.0.3';
'compute1': ip => '172.16.0.4';
'compute2': ip => '172.16.0.14';
'novacontroller': ip => '172.16.0.5';
'glance': ip => '172.16.0.6';
'keystone': ip => '172.16.0.7';
'mysql': ip => '172.16.0.8';
'cinderclient': ip => '172.16.0.9';
'quantumagent': ip => '172.16.0.10';
}
group { 'puppet':
ensure => 'present',
}

View File

@@ -1,3 +1,5 @@
import 'hosts.pp'
#
# This puppet manifest is already applied first to do some environment specific things
#
@@ -28,26 +30,6 @@ exec { '/usr/bin/apt-get update':
logoutput => true,
}
#
# specify a connection to the hardcoded puppet master
#
host {
'puppet': ip => '172.16.0.2';
'openstackcontroller': ip => '172.16.0.3';
'compute1': ip => '172.16.0.4';
'compute2': ip => '172.16.0.14';
'novacontroller': ip => '172.16.0.5';
'glance': ip => '172.16.0.6';
'keystone': ip => '172.16.0.7';
'mysql': ip => '172.16.0.8';
'cinderclient': ip => '172.16.0.9';
'quantumagent': ip => '172.16.0.10';
}
group { 'puppet':
ensure => 'present',
}
# bring up the bridging interface explicitly
#exec { '/sbin/ifconfig eth2 up': }

View File

@@ -73,7 +73,17 @@ node /openstack-controller/ {
quantum => $use_quantum,
}
include apache
if $::osfamily == 'Debian' {
include 'apache'
} else {
package { 'httpd':
ensure => present
}~>
service { 'httpd':
ensure => running,
enable => true
}
}
class { 'openstack::controller':
#floating_range => $floating_network_range,