Merge pull request #82 from bodepd/enable_params

Add enabled parameter to nova::controller
This commit is contained in:
Branan Purvine-Riley
2012-06-25 16:03:26 -07:00

View File

@@ -2,7 +2,7 @@
# This can be used to build out the simplest openstack controller # This can be used to build out the simplest openstack controller
# #
# #
# $export_resources - rather resources should be exported # $export_resources - Whether resources should be exported
# #
# [public_interface] Public interface used to route public traffic. Required. # [public_interface] Public interface used to route public traffic. Required.
# [public_address] Public address for public endpoints. Required. # [public_address] Public address for public endpoints. Required.
@@ -43,6 +43,8 @@
# Each app is defined in two parts, the display name, and the URI # Each app is defined in two parts, the display name, and the URI
# [horizon_app_links] array as in '[ ["Nagios","http://nagios_addr:port/path"],["Ganglia","http://ganglia_addr"] ]' # [horizon_app_links] array as in '[ ["Nagios","http://nagios_addr:port/path"],["Ganglia","http://ganglia_addr"] ]'
# #
# [enabled] Whether services should be enabled. This parameter can be used to
# implement services in active-passive modes for HA. Optional. Defaults to true.
class openstack::controller( class openstack::controller(
# my address # my address
$public_address, $public_address,
@@ -84,6 +86,7 @@ class openstack::controller(
$swift = false, $swift = false,
$quantum = false, $quantum = false,
$horizon_app_links = false, $horizon_app_links = false,
$enabled = true
) { ) {
$glance_api_servers = "${internal_address}:9292" $glance_api_servers = "${internal_address}:9292"
@@ -116,21 +119,25 @@ class openstack::controller(
# TODO I should make sure that this works # TODO I should make sure that this works
# 'root_password' => $mysql_root_password, # 'root_password' => $mysql_root_password,
'bind_address' => '0.0.0.0' 'bind_address' => '0.0.0.0'
},
enabled => $enabled,
}
if ($enabled) {
# set up all openstack databases, users, grants
class { 'keystone::db::mysql':
password => $keystone_db_password,
}
Class['glance::db::mysql'] -> Class['glance::registry']
class { 'glance::db::mysql':
host => '127.0.0.1',
password => $glance_db_password,
}
# TODO should I allow all hosts to connect?
class { 'nova::db::mysql':
password => $nova_db_password,
host => $internal_address,
allowed_hosts => '%',
} }
}
# set up all openstack databases, users, grants
class { 'keystone::db::mysql':
password => $keystone_db_password,
}
class { 'glance::db::mysql':
host => '127.0.0.1',
password => $glance_db_password,
}
# TODO should I allow all hosts to connect?
class { 'nova::db::mysql':
password => $nova_db_password,
host => $internal_address,
allowed_hosts => '%',
} }
####### KEYSTONE ########### ####### KEYSTONE ###########
@@ -144,36 +151,42 @@ class openstack::controller(
log_verbose => $verbose, log_verbose => $verbose,
log_debug => $verbose, log_debug => $verbose,
catalog_type => 'sql', catalog_type => 'sql',
enabled => $enabled,
} }
# set up keystone database # set up keystone database
# set up the keystone config for mysql # set up the keystone config for mysql
class { 'keystone::config::mysql': class { 'keystone::config::mysql':
password => $keystone_db_password, password => $keystone_db_password,
} }
# set up keystone admin users
class { 'keystone::roles::admin': if ($enabled) {
email => $admin_email, # set up keystone admin users
password => $admin_password, class { 'keystone::roles::admin':
} email => $admin_email,
# set up the keystone service and endpoint password => $admin_password,
class { 'keystone::endpoint': }
public_address => $public_address, # set up the keystone service and endpoint
internal_address => $internal_address, class { 'keystone::endpoint':
admin_address => $admin_address, public_address => $public_address,
} internal_address => $internal_address,
# set up glance service,user,endpoint admin_address => $admin_address,
class { 'glance::keystone::auth': }
password => $glance_user_password, # set up glance service,user,endpoint
public_address => $public_address, class { 'glance::keystone::auth':
internal_address => $internal_address, password => $glance_user_password,
admin_address => $admin_address, public_address => $public_address,
} internal_address => $internal_address,
# set up nova serice,user,endpoint admin_address => $admin_address,
class { 'nova::keystone::auth': before => [Class['glance::api'], Class['glance::registry']]
password => $nova_user_password, }
public_address => $public_address, # set up nova serice,user,endpoint
internal_address => $internal_address, class { 'nova::keystone::auth':
admin_address => $admin_address, password => $nova_user_password,
public_address => $public_address,
internal_address => $internal_address,
admin_address => $admin_address,
before => Class['nova::api'],
}
} }
######## END KEYSTONE ########## ######## END KEYSTONE ##########
@@ -190,7 +203,7 @@ class openstack::controller(
keystone_tenant => 'services', keystone_tenant => 'services',
keystone_user => 'glance', keystone_user => 'glance',
keystone_password => $glance_user_password, keystone_password => $glance_user_password,
require => Keystone_user_role["glance@services"], enabled => $enabled,
} }
class { 'glance::backend::file': } class { 'glance::backend::file': }
@@ -204,7 +217,7 @@ class openstack::controller(
keystone_user => 'glance', keystone_user => 'glance',
keystone_password => $glance_user_password, keystone_password => $glance_user_password,
sql_connection => "mysql://glance:${glance_db_password}@127.0.0.1/glance", sql_connection => "mysql://glance:${glance_db_password}@127.0.0.1/glance",
require => [Class['Glance::Db::Mysql'], Keystone_user_role['glance@services']] enabled => $enabled,
} }
######## END GLANCE ########### ######## END GLANCE ###########
@@ -215,6 +228,7 @@ class openstack::controller(
class { 'nova::rabbitmq': class { 'nova::rabbitmq':
userid => $rabbit_user, userid => $rabbit_user,
password => $rabbit_password, password => $rabbit_password,
enabled => $enabled,
} }
# TODO I may need to figure out if I need to set the connection information # TODO I may need to figure out if I need to set the connection information
@@ -231,7 +245,7 @@ class openstack::controller(
} }
class { 'nova::api': class { 'nova::api':
enabled => true, enabled => $enabled,
# TODO this should be the nova service credentials # TODO this should be the nova service credentials
#admin_tenant_name => 'openstack', #admin_tenant_name => 'openstack',
#admin_user => 'admin', #admin_user => 'admin',
@@ -239,7 +253,6 @@ class openstack::controller(
admin_tenant_name => 'services', admin_tenant_name => 'services',
admin_user => 'nova', admin_user => 'nova',
admin_password => $nova_user_password, admin_password => $nova_user_password,
require => Keystone_user_role["nova@services"],
} }
class { [ class { [
@@ -249,14 +262,24 @@ class openstack::controller(
'nova::objectstore', 'nova::objectstore',
'nova::vncproxy' 'nova::vncproxy'
]: ]:
enabled => true, enabled => $enabled,
} }
if $multi_host { if $multi_host {
nova_config { 'multi_host': value => 'True'; } nova_config { 'multi_host': value => 'True'; }
$enable_network_service = false $enable_network_service = false
} else { } else {
$enable_network_service = true if $enabled == true {
$enable_network_service = true
} else {
$enable_network_service = false
}
}
if $enabled {
$really_create_networks = $create_networks
} else {
$really_create_networks = false
} }
# set up networking # set up networking
@@ -267,7 +290,7 @@ class openstack::controller(
floating_range => $floating_range, floating_range => $floating_range,
network_manager => $network_manager, network_manager => $network_manager,
config_overrides => $network_config, config_overrides => $network_config,
create_networks => $create_networks, create_networks => $really_create_networks,
num_networks => $num_networks, num_networks => $num_networks,
enabled => $enable_network_service, enabled => $enable_network_service,
install_service => $enable_network_service, install_service => $enable_network_service,
@@ -279,6 +302,8 @@ class openstack::controller(
######## Horizon ######## ######## Horizon ########
# TOOO - what to do about HA for horizon?
class { 'memcached': class { 'memcached':
listen_ip => '127.0.0.1', listen_ip => '127.0.0.1',
} }