refactor all.pp

Massive refactor for all in one installation
for folsom.
This commit is contained in:
Joe Topjian
2012-10-24 11:46:12 -07:00
committed by Dan Bode
parent 7e9d20669b
commit 94f5b516a6

View File

@@ -59,60 +59,66 @@
class openstack::all (
# Network Required
$public_address,
# MySQL Required
$mysql_root_password = 'sql_pass',
# Rabbit Required
$rabbit_password = 'rabbitpw',
# Keystone Required
$keystone_db_password = 'keystone_pass',
$keystone_admin_token = 'keystone_admin_token',
$admin_email = 'some_user@some_fake_email_address.foo',
$admin_password = 'ChangeMe',
# Nova Required
$nova_db_password = 'nova_pass',
$nova_user_password = 'nova_pass',
# Glance Required
$glance_db_password = 'glance_pass',
$glance_user_password = 'glance_pass',
# Horizon Required
$secret_key = 'dummy_secret_key',
# Network
$public_interface = 'eth0',
$private_interface = 'eth1',
$fixed_range = '10.0.0.0/24',
$network_manager = 'nova.network.manager.FlatDHCPManager',
$network_config = {},
$auto_assign_floating_ip = false,
$floating_range = false,
$create_networks = true,
$num_networks = 1,
# MySQL
# Database
$mysql_root_password = 'sql_pass',
$db_type = 'mysql',
$mysql_account_security = true,
$allowed_hosts = ['127.0.0.%'],
# Rabbit
$rabbit_user = 'nova',
# Keystone
$admin_email = 'some_user@some_fake_email_address.foo',
$admin_password = 'ChangeMe',
$keystone_db_password = 'keystone_pass',
$keystone_db_user = 'keystone',
$keystone_db_dbname = 'keystone',
$keystone_admin_token = 'keystone_admin_token',
$keystone_admin_tenant = 'admin',
# Nova
$nova_db_user = 'nova',
$nova_db_dbname = 'nova',
$purge_nova_config = true,
# Glance
$region = 'RegionOne',
# Glance Required
$glance_db_password = 'glance_pass',
$glance_db_user = 'glance',
$glance_db_dbname = 'glance',
$glance_user_password = 'glance_pass',
# Nova
$nova_db_password = 'nova_pass',
$nova_db_user = 'nova',
$nova_db_dbname = 'nova',
$nova_user_password = 'nova_pass',
$purge_nova_config = true,
# Network
$network_manager = 'nova.network.manager.FlatDHCPManager',
$fixed_range = '10.0.0.0/24',
$floating_range = false,
$create_networks = true,
$num_networks = 1,
$auto_assign_floating_ip = false,
$network_config = {},
$quantum = true,
# Rabbit
$rabbit_password = 'rabbit_pw',
$rabbit_user = 'nova',
# Horizon
$secret_key = 'dummy_secret_key',
$cache_server_ip = '127.0.0.1',
$cache_server_port = '11211',
$swift = false,
$quantum = false,
$horizon_app_links = undef,
# if the cinder management components should be installed
$cinder = true,
$cinder_user_password = 'cinder_user_pass',
$cinder_db_password = 'cinder_db_pass',
$cinder_db_user = 'cinder',
$cinder_db_dbname = 'cinder',
$volume_group = 'cinder-volumes',
$cinder_test = false,
#
$quantum_user_password = 'quantum_user_pass',
$quantum_db_password = 'quantum_db_pass',
$quantum_db_user = 'quantum',
$quantum_db_dbname = 'quantum',
# Virtaulization
$libvirt_type = 'kvm',
# Volume
$nova_volume = 'nova-volumes',
# VNC
$vnc_enabled = true,
# General
@@ -123,26 +129,36 @@ class openstack::all (
# Ensure things are run in order
Class['openstack::db::mysql'] -> Class['openstack::keystone']
Class['openstack::db::mysql'] -> Class['openstack::glance']
Class['openstack::db::mysql'] -> Class['openstack::nova::controller']
# set up mysql server
case $db_type {
'mysql': {
class { 'openstack::db::mysql':
mysql_root_password => $mysql_root_password,
mysql_bind_address => '127.0.0.1',
mysql_account_security => $mysql_account_security,
keystone_db_user => $keystone_db_user,
keystone_db_password => $keystone_db_password,
keystone_db_dbname => $keystone_db_dbname,
glance_db_user => $glance_db_user,
glance_db_password => $glance_db_password,
glance_db_dbname => $glance_db_dbname,
nova_db_user => $nova_db_user,
nova_db_password => $nova_db_password,
nova_db_dbname => $nova_db_dbname,
allowed_hosts => $allowed_hosts,
}
if ($db_type == 'mysql') {
if ($enabled) {
Class['glance::db::mysql'] -> Class['glance::registry']
$nova_db = "mysql://${nova_db_user}:${nova_db_password}@127.0.0.1/nova?charset=utf8"
} else {
$nova_db = false
}
class { 'openstack::db::mysql':
mysql_root_password => $mysql_root_password,
mysql_account_security => $mysql_account_security,
keystone_db_user => $keystone_db_user,
keystone_db_password => $keystone_db_password,
keystone_db_dbname => $keystone_db_dbname,
glance_db_user => $glance_db_user,
glance_db_password => $glance_db_password,
glance_db_dbname => $glance_db_dbname,
nova_db_user => $nova_db_user,
nova_db_password => $nova_db_password,
nova_db_dbname => $nova_db_dbname,
cinder => $cinder,
cinder_db_user => $cinder_db_user,
cinder_db_password => $cinder_db_password,
cinder_db_dbname => $cinder_db_dbname,
quantum => $quantum,
quantum_db_user => $quantum_db_user,
quantum_db_password => $quantum_db_password,
quantum_db_dbname => $quantum_db_dbname,
allowed_hosts => $allowed_hosts,
}
}
@@ -151,18 +167,23 @@ class openstack::all (
verbose => $verbose,
db_type => $db_type,
db_host => '127.0.0.1',
keystone_db_password => $keystone_db_password,
keystone_db_dbname => $keystone_db_dbname,
keystone_db_user => $keystone_db_user,
keystone_admin_token => $keystone_admin_token,
keystone_admin_tenant => $keystone_admin_tenant,
db_password => $keystone_db_password,
db_name => $keystone_db_dbname,
db_user => $keystone_db_user,
admin_token => $keystone_admin_token,
admin_tenant => $keystone_admin_tenant,
admin_email => $admin_email,
admin_password => $admin_password,
public_address => $public_address,
internal_address => '127.0.0.1',
admin_address => '127.0.0.1',
region => $region,
glance_user_password => $glance_user_password,
nova_user_password => $nova_user_password,
cinder => $cinder,
cinder_user_password => $cinder_user_password,
quantum => $quantum,
quantum_user_password => $quantum_user_password,
}
######## GLANCE ##########
@@ -174,6 +195,7 @@ class openstack::all (
glance_db_dbname => $glance_db_dbname,
glance_db_password => $glance_db_password,
glance_user_password => $glance_user_password,
enabled => $enabled,
}
######## NOVA ###########
@@ -188,68 +210,108 @@ class openstack::all (
}
}
class { 'openstack::nova::controller':
# Network
network_manager => $network_manager,
network_config => $network_config,
private_interface => $private_interface,
public_interface => $public_interface,
floating_range => $floating_range,
fixed_range => $fixed_range,
public_address => $public_address,
admin_address => '127.0.0.1',
internal_address => '127.0.0.1',
auto_assign_floating_ip => $auto_assign_floating_ip,
create_networks => $create_networks,
num_networks => $num_networks,
multi_host => false,
# Database
db_host => '127.0.0.1',
# Nova
nova_user_password => $nova_user_password,
nova_db_password => $nova_db_password,
nova_db_user => $nova_db_user,
nova_db_dbname => $nova_db_dbname,
# Rabbit
rabbit_user => $rabbit_user,
rabbit_password => $rabbit_password,
# Glance
glance_api_servers => '127.0.0.1:9292',
# VNC
vnc_enabled => $vnc_enabled,
# General
verbose => $verbose,
enabled => $enabled,
exported_resources => false,
# Install / configure rabbitmq
class { 'nova::rabbitmq':
userid => $rabbit_user,
password => $rabbit_password,
enabled => $enabled,
}
class { 'openstack::nova::compute':
# Network
public_address => $public_address,
private_interface => $private_interface,
public_interface => $public_interface,
fixed_range => $fixed_range,
network_manager => $network_manager,
network_config => $network_config,
multi_host => false,
internal_address => '127.0.0.1',
# Virtualization
libvirt_type => $libvirt_type,
# Volumes
nova_volume => $nova_volume,
manage_volumes => true,
iscsi_ip_address => '127.0.0.1',
# VNC
vnc_enabled => $vnc_enabled,
vncproxy_host => $public_address,
# Nova
nova_user_password => $nova_user_password,
# Rabbit
rabbit_password => $rabbit_password,
# General
verbose => $verbose,
exported_resources => false,
# Configure Nova
class { 'nova':
sql_connection => $nova_db,
rabbit_userid => $rabbit_user,
rabbit_password => $rabbit_password,
image_service => 'nova.image.glance.GlanceImageService',
glance_api_servers => 'localhost:9292',
verbose => $verbose,
rabbit_host => $internal_address,
}
# Configure nova-api
class { 'nova::api':
enabled => $enabled,
admin_password => $nova_user_password,
auth_host => 'localhost',
}
if $enabled {
$really_create_networks = $create_networks
} else {
$really_create_networks = false
}
if $quantum == false {
# Configure nova-network
class { 'nova::network':
private_interface => $private_interface,
public_interface => $public_interface,
fixed_range => $fixed_range,
floating_range => $floating_range,
network_manager => $network_manager,
config_overrides => $network_config,
create_networks => $really_create_networks,
num_networks => $num_networks,
enabled => $enabled,
}
} else {
# Set up Quantum
}
if $auto_assign_floating_ip {
nova_config { 'auto_assign_floating_ip': value => 'True' }
}
class { [
'nova::scheduler',
'nova::objectstore',
'nova::cert',
'nova::consoleauth'
]:
enabled => $enabled,
}
if $vnc_enabled {
class { 'nova::vncproxy':
host => $public_address,
enabled => $enabled,
}
}
######### Cinder Controller Services ########
if ($cinder) {
class { "cinder::base":
verbose => $verbose,
sql_connection => "mysql://${cinder_db_user}:${cinder_db_password}@127.0.0.1/${cinder_db_dbname}?charset=utf8",
rabbit_password => $rabbit_password,
}
class { 'cinder::api':
keystone_password => $cinder_user_password,
}
class { 'cinder::scheduler': }
class { 'cinder::volume': }
class { 'cinder::volume::iscsi':
volume_group => $volume_group,
test => $cinder_test,
}
} else {
# Set up nova-volume
}
# Install / configure nova-compute
class { '::nova::compute':
enabled => $enabled,
vnc_enabled => $vnc_enabled,
vncserver_proxyclient_address => $internal_address,
vncproxy_host => 'localhost',
}
# Configure libvirt for nova-compute
class { 'nova::compute::libvirt':
libvirt_type => $libvirt_type,
vncserver_listen => $internal_address,
}
######## Horizon ########