Skip to content

Commit

Permalink
Merge pull request redhat-openstack#25 from GregSutcliffe/master
Browse files Browse the repository at this point in the history
Parameterize trystack classes, remove old globals from JSON, style cleanup
  • Loading branch information
jsomara committed May 29, 2013
2 parents cc9b8eb + 210056c commit 0b6efaa
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 106 deletions.
23 changes: 0 additions & 23 deletions bin/foreman-params.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,6 @@
"name": "proxy1",
"host": "https://foreman_hostname:8443"
},
"globals": {
"admin_email": "EDIT ME: EG [email protected]",
"admin_password": "CHANGEME",
"controller_node_public": "EDIT ME: EG 10.100.0.2",
"fixed_network_range": "EDIT ME: EG 10.100.10.0/24",
"floating_network_range": "EDIT ME: EG 8.21.28.128/25",
"pacemaker_pub_floating_ip": "EDIT ME: EG 10.100.10.0/24",
"pacemaker_priv_floating_ip": "EDIT ME: EG 8.21.28.128/25",
"glance_db_password": "CHANGEME",
"glance_user_password": "CHANGEME",
"horizon_secret_key": "secret",
"keystone_admin_token": "secret",
"keystone_db_password": "CHANGEME",
"keystone_password": "CHANGEME",
"mysql_root_password": "CHANGEME",
"nova_db_password": "CHANGEME",
"nova_user_password": "CHANGEME",
"cinder_db_password": "CHANGEME",
"cinder_user_password": "CHANGEME",
"private_interface": "EDIT ME: em1",
"public_interface": "EDIT ME: em2",
"verbose": "true"
},
"hostgroups": {
"OpenStack Controller": {
"environment": "production",
Expand Down
28 changes: 17 additions & 11 deletions bin/foreman_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ cp ../config/dbmigrate $FOREMAN_DIR/extras/
# turn on certificate autosigning
echo '*' >> $SCL_RUBY_HOME/etc/puppet/autosign.conf

# Configure class defaults
# This is not ideal, but will work until the API v2 is ready

PASSWD_COUNT=$(cat ../puppet/trystack/manifests/params.pp | grep CHANGEME | wc -l)

for i in $(seq $PASSWD_COUNT)
do
export PASSWD=$(scl enable ruby193 "ruby foreman-setup.rb password")
sed -i "/CHANGEME/ {s/CHANGEME/$PASSWD/;:a;n;ba}" ../puppet/trystack/manifests/params.pp
done

# install puppet modules
mkdir -p $SCL_RUBY_HOME/etc/puppet/environments/production/modules
cp -r ../puppet/* $SCL_RUBY_HOME/etc/puppet/environments/production/modules/
Expand All @@ -107,16 +118,7 @@ sudo -u foreman scl enable ruby193 "cd $FOREMAN_DIR; RAILS_ENV=production rake p

sed -i "s/foreman_hostname/$PUPPETMASTER/" foreman-params.json

export PASSWD_COUNT=$(cat foreman-params.json | grep changeme | wc -l)

for i in $(seq $PASSWD_COUNT)
do
export PASSWD=$(scl enable ruby193 "ruby foreman-setup.rb password")
sed -i "/CHANGEME/ {s/CHANGEME/$PASSWD/;:a;n;ba}" foreman-params.json
done

scl enable ruby193 "ruby foreman-setup.rb proxy"
scl enable ruby193 "ruby foreman-setup.rb globals"
scl enable ruby193 "ruby foreman-setup.rb hostgroups"
# write client-register-to-foreman script
# TODO don't hit yum unless packages are not installed
Expand All @@ -143,8 +145,12 @@ scl enable ruby193 "puppet agent --test"
EOF

echo "Foreman is installed and almost ready for setting up your OpenStack"
echo "First, you need to input a few parameters into foreman."
echo "Visit https://$(hostname)/common_parameters"
echo "First, you need to alter a few parameters in Foreman."
echo "Visit:"
echo "https://$(hostname)/puppetclasses/trystack::compute/edit"
echo "https://$(hostname)/puppetclasses/trystack::controller/edit"
echo "Go to the Smart Class Parameters tab and work though each of the parameters"
echo "in the left-hand column"
echo ""
echo "Then copy /tmp/foreman_client.sh to your openstack client nodes"
echo "Run that script and visit the HOSTS tab in foreman. Pick CONTROLLER"
Expand Down
30 changes: 20 additions & 10 deletions puppet/trystack/manifests/compute.pp
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@

# Common trystack configurations
class trystack::compute(){
class trystack::compute (
$fixed_network_range = $trystack::params::fixed_network_range,
$floating_network_range = $trystack::params::floating_network_range,
$nova_db_password = $trystack::params::nova_db_password,
$nova_user_password = $trystack::params::nova_user_password,
$pacemaker_priv_floating_ip = $trystack::params::pacemaker_priv_floating_ip,
$private_interface = $trystack::params::private_interface,
$public_interface = $trystack::params::public_interface,
$verbose = $trystack::params::verbose,
) inherits trystack::params {

# Configure Nova
nova_config{
'auto_assign_floating_ip': value => 'True';
#"network_host": value => "${pacemaker_priv_floating_ip}";
"network_host": value => "$::ipaddress";
'auto_assign_floating_ip': value => 'True';
#"network_host": value => ${pacemaker_priv_floating_ip;
"network_host": value => "$::ipaddress";
"libvirt_inject_partition": value => "-1";
#"metadata_host": value => "$pacemaker_priv_floating_ip";
"metadata_host": value => "$::ipaddress";
"qpid_hostname": value => "$pacemaker_priv_floating_ip";
"rpc_backend": value => "nova.rpc.impl_qpid";
"multi_host": value => "True";
#"metadata_host": value => "$pacemaker_priv_floating_ip";
"metadata_host": value => "$::ipaddress";
"qpid_hostname": value => "$pacemaker_priv_floating_ip";
"rpc_backend": value => "nova.rpc.impl_qpid";
"multi_host": value => "True";
}

class { 'nova':
Expand All @@ -22,6 +32,7 @@
}

# uncomment if on a vm
# GSutclif: Maybe wrap this in a Facter['is-virtual'] test ?
#file { "/usr/bin/qemu-system-x86_64":
# ensure => link,
# target => "/usr/libexec/qemu-kvm",
Expand Down Expand Up @@ -66,5 +77,4 @@
action => 'accept',
}


}
138 changes: 76 additions & 62 deletions puppet/trystack/manifests/controller.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,52 @@
# refine iptable rules, their probably giving access to the public
#

class trystack::controller(){

#pacemaker::corosync { "trystack": }

#pacemaker::corosync::node { "10.100.0.2": }
#pacemaker::corosync::node { "10.100.0.3": }

#pacemaker::resources::ip { "8.21.28.222":
# address => "8.21.28.222",
class trystack::controller (
$admin_email = $trystack::params::admin_email,
$admin_password = $trystack::params::admin_password,
$cinder_db_password = $trystack::params::cinder_db_password,
$cinder_user_password = $trystack::params::cinder_user_password,
$glance_db_password = $trystack::params::glance_db_password,
$glance_user_password = $trystack::params::glance_user_password,
$horizon_secret_key = $trystack::params::horizon_secret_key,
$keystone_admin_token = $trystack::params::keystone_admin_token,
$keystone_db_password = $trystack::params::keystone_db_password,
$mysql_root_password = $trystack::params::mysql_root_password,
$nova_db_password = $trystack::params::nova_db_password,
$nova_user_password = $trystack::params::nova_user_password,
$pacemaker_priv_floating_ip = $trystack::params::pacemaker_priv_floating_ip,
$pacemaker_pub_floating_ip = $trystack::params::pacemaker_pub_floating_ip,
$verbose = $trystack::params::verbose
) inherits trystack::params {

#pacemaker::corosync { 'trystack': }

#pacemaker::corosync::node { '10.100.0.2': }
#pacemaker::corosync::node { '10.100.0.3': }

#pacemaker::resources::ip { '8.21.28.222':
# address => '8.21.28.222',
#}
#pacemaker::resources::ip { "10.100.0.222":
# address => "10.100.0.222",
#pacemaker::resources::ip { '10.100.0.222':
# address => '10.100.0.222',
#}

#pacemaker::resources::lsb { "qpidd": }
#pacemaker::resources::lsb { 'qpidd': }

#pacemaker::stonith::ipmilan { "$ipmi_address":
# address => "$ipmi_address",
# user => "$ipmi_user",
# password => "$ipmi_pass",
# hostlist => "$ipmi_host_list",
#pacemaker::stonith::ipmilan { $ipmi_address:
# address => $ipmi_address,
# user => $ipmi_user,
# password => $ipmi_pass,
# hostlist => $ipmi_host_list,
#}

class {"openstack::db::mysql":
mysql_root_password => "$mysql_root_password",
keystone_db_password => "$keystone_db_password",
glance_db_password => "$glance_db_password",
nova_db_password => "$nova_db_password",
cinder_db_password => "$cinder_db_password",
quantum_db_password => "",
class {'openstack::db::mysql':
mysql_root_password => $mysql_root_password,
keystone_db_password => $keystone_db_password,
glance_db_password => $glance_db_password,
nova_db_password => $nova_db_password,
cinder_db_password => $cinder_db_password,
quantum_db_password => '',

# MySQL
mysql_bind_address => '0.0.0.0',
Expand All @@ -44,44 +60,43 @@
# quantum
quantum => false,

allowed_hosts => "%",
allowed_hosts => '%',
enabled => true,
}

class {"qpid::server":
class {'qpid::server':
auth => "no"
}


class {"openstack::keystone":
db_host => "${pacemaker_priv_floating_ip}",
db_password => "$keystone_db_password",
admin_token => "$keystone_admin_token",
admin_email => "$admin_email",
admin_password => "$admin_password",
glance_user_password => "$glance_user_password",
nova_user_password => "$nova_user_password",
cinder_user_password => "$cinder_user_password",
class {'openstack::keystone':
db_host => $pacemaker_priv_floating_ip,
db_password => $keystone_db_password,
admin_token => $keystone_admin_token,
admin_email => $admin_email,
admin_password => $admin_password,
glance_user_password => $glance_user_password,
nova_user_password => $nova_user_password,
cinder_user_password => $cinder_user_password,
quantum_user_password => "",
public_address => "${pacemaker_pub_floating_ip}",
admin_address => "${pacemaker_priv_floating_ip}",
internal_address => "${pacemaker_priv_floating_ip}",
public_address => $pacemaker_pub_floating_ip,
admin_address => $pacemaker_priv_floating_ip,
internal_address => $pacemaker_priv_floating_ip,
quantum => false,
cinder => true,
enabled => true,
require => Class["openstack::db::mysql"],
require => Class['openstack::db::mysql'],
}

class { 'swift::keystone::auth':
password => $swift_admin_password,
address => "${pacemaker_priv_floating_ip}",
address => $pacemaker_priv_floating_ip,
}

class {"openstack::glance":
db_host => "${pacemaker_priv_floating_ip}",
glance_user_password => "$glance_user_password",
glance_db_password => "$glance_db_password",
require => Class["openstack::db::mysql"],
class {'openstack::glance':
db_host => $pacemaker_priv_floating_ip,
glance_user_password => $glance_user_password,
glance_db_password => $glance_db_password,
require => Class['openstack::db::mysql'],
}

# Configure Nova
Expand All @@ -90,46 +105,45 @@
image_service => 'nova.image.glance.GlanceImageService',
glance_api_servers => "https://${pacemaker_priv_floating_ip}:9292/v1",
verbose => $verbose,
require => Class["openstack::db::mysql", "qpid::server"],
require => Class['openstack::db::mysql', 'qpid::server'],
}

class { 'nova::api':
enabled => true,
admin_password => "$nova_user_password",
auth_host => "${pacemaker_priv_floating_ip}",
admin_password => $nova_user_password,
auth_host => $pacemaker_priv_floating_ip,
}

nova_config {
'auto_assign_floating_ip': value => 'True';
"rpc_backend": value => "nova.rpc.impl_qpid";
"multi_host": value => "True";
"force_dhcp_release": value => "False";
'rpc_backend': value => 'nova.rpc.impl_qpid';
'multi_host': value => 'True';
'force_dhcp_release': value => 'False';
}

class { [ 'nova::scheduler', 'nova::cert', 'nova::consoleauth' ]:
enabled => true,
}

class { 'nova::vncproxy':
host => "0.0.0.0",
host => '0.0.0.0',
enabled => true,
}


package {"horizon-packages":
name => ["python-memcached", "python-netaddr"],
notify => Class["horizon"],
package {'horizon-packages':
name => ['python-memcached', 'python-netaddr'],
notify => Class['horizon'],
}

file {"/etc/httpd/conf.d/rootredirect.conf":
ensure => present,
file {'/etc/httpd/conf.d/rootredirect.conf':
ensure => present,
content => 'RedirectMatch ^/$ /dashboard/',
notify => File["/etc/httpd/conf.d/openstack-dashboard.conf"],
notify => File['/etc/httpd/conf.d/openstack-dashboard.conf'],
}

class {'horizon':
secret_key => "$horizon_secret_key",
keystone_host => "${pacemaker_priv_floating_ip}",
secret_key => $horizon_secret_key,
keystone_host => $pacemaker_priv_floating_ip,
}

class {'memcached':}
Expand Down
29 changes: 29 additions & 0 deletions puppet/trystack/manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class trystack::params {
$verbose = 'true'

# Passwords are currently changed to decent strings by sed
# during the setup process. This will move to the Foreman API v2
# at some point.
$admin_password = 'CHANGEME'
$cinder_db_password = 'CHANGEME'
$cinder_user_password = 'CHANGEME'
$glance_db_password = 'CHANGEME'
$glance_user_password = 'CHANGEME'
$horizon_secret_key = 'CHANGEME'
$keystone_admin_token = 'CHANGEME'
$keystone_db_password = 'CHANGEME'
$mysql_root_password = 'CHANGEME'
$nova_db_password = 'CHANGEME'
$nova_user_password = 'CHANGEME'

# Networking
$private_interface = 'eth1'
$public_interface = 'eth0'
$fixed_network_range = inline_template("<%= scope.lookupvar('::network_${private_interface}') + '/' + scope.lookupvar('::netmask_${private_interface}') %>")
$floating_network_range = inline_template("<%= scope.lookupvar('::network_${public_interface}') + '/' + scope.lookupvar('::netmask_${public_interface}') %>")
$pacemaker_priv_floating_ip = inline_template("<%= scope.lookupvar('::ipaddress_${private_interface}') %>")
$pacemaker_pub_floating_ip = inline_template("<%= scope.lookupvar('::ipaddress_${public_interface}') %>")

# Logs
$admin_email = "admin@${::domain}"
}

0 comments on commit 0b6efaa

Please sign in to comment.