From 7ec31b2b3bbfc89b3e6478df120a6445f7261fc2 Mon Sep 17 00:00:00 2001 From: Florian Haas Date: Sun, 14 Jul 2013 10:57:12 +0000 Subject: [PATCH] Move endpoints into API definitions --- manifests/cinder/api.pp | 9 ++++++-- manifests/cinder/endpoint.pp | 5 ----- manifests/endpoint.pp | 10 +++------ manifests/glance/api.pp | 7 +++++- manifests/glance/endpoint.pp | 5 ----- manifests/keystone/api.pp | 15 +++++++++++++ manifests/keystone/endpoint.pp | 21 ------------------ manifests/node/api.pp | 39 +++++++++++++++++++++++++++++----- manifests/node/auth.pp | 12 +++++------ manifests/nova/api.pp | 13 ++++++++---- manifests/nova/endpoint.pp | 5 ----- manifests/quantum/endpoint.pp | 5 ----- manifests/quantum/server.pp | 10 +++++++-- 13 files changed, 88 insertions(+), 68 deletions(-) delete mode 100644 manifests/cinder/endpoint.pp delete mode 100644 manifests/glance/endpoint.pp delete mode 100644 manifests/keystone/endpoint.pp delete mode 100644 manifests/nova/endpoint.pp delete mode 100644 manifests/quantum/endpoint.pp diff --git a/manifests/cinder/api.pp b/manifests/cinder/api.pp index 31cae45..7a29762 100644 --- a/manifests/cinder/api.pp +++ b/manifests/cinder/api.pp @@ -1,15 +1,20 @@ class kickstack::cinder::api inherits kickstack { include kickstack::cinder::config + include pwgen - $service_password = getvar("${fact_prefix}cinder_keystone_password") + $service_password = pick(getvar("${fact_prefix}cinder_keystone_password"),pwgen()) $keystone_internal_address = getvar("${fact_prefix}keystone_internal_address") class { '::cinder::api': keystone_tenant => $kickstack::keystone_service_tenant, keystone_user => 'cinder', keystone_password => $service_password, - keystone_auth_host => $keystone_internal_address + keystone_auth_host => $keystone_internal_address, } + kickstack::endpoint { 'cinder': + service_password => $service_password, + require => Class['::cinder::api'] + } } diff --git a/manifests/cinder/endpoint.pp b/manifests/cinder/endpoint.pp deleted file mode 100644 index 0b78bc8..0000000 --- a/manifests/cinder/endpoint.pp +++ /dev/null @@ -1,5 +0,0 @@ -class kickstack::cinder::endpoint inherits kickstack { - - kickstack::endpoint { 'cinder': } - -} diff --git a/manifests/endpoint.pp b/manifests/endpoint.pp index c808dff..c19942f 100644 --- a/manifests/endpoint.pp +++ b/manifests/endpoint.pp @@ -1,4 +1,4 @@ -define kickstack::endpoint { +define kickstack::endpoint ( $service_password ) { include pwgen @@ -6,16 +6,12 @@ define kickstack::endpoint { $factname = "${servicename}_keystone_password" $classname = "${servicename}::keystone::auth" - # Grab the service's keystone user password from a kickstack fact and configure - # Keystone accordingly. If no fact has been set, generate a password. - $service_password = pick(getvar("${::kickstack::fact_prefix}${factname}"),pwgen()) - # Installs the service user endpoint. class { "${classname}": - password => "$service_password", + password => $service_password, public_address => "${hostname}${::kickstack::keystone_public_suffix}", admin_address => "${hostname}${::kickstack::keystone_admin_suffix}", - internal_address => "$hostname", + internal_address => $hostname, region => "$::kickstack::keystone_region", require => Class['::keystone'], } diff --git a/manifests/glance/api.pp b/manifests/glance/api.pp index 75a60dc..5b5fbcc 100644 --- a/manifests/glance/api.pp +++ b/manifests/glance/api.pp @@ -1,9 +1,10 @@ class kickstack::glance::api inherits kickstack { include kickstack::glance::config + include pwgen $auth_host = getvar("${fact_prefix}keystone_internal_address") - $service_password = getvar("${fact_prefix}glance_keystone_password") + $service_password = pick(getvar("${fact_prefix}glance_keystone_password"),pwgen()) $sql_conn = getvar("${fact_prefix}glance_sql_connection") $reg_host = getvar("${fact_prefix}glance_registry_host") @@ -19,4 +20,8 @@ class kickstack::glance::api inherits kickstack { registry_host => $reg_host, } + kickstack::endpoint { 'glance': + service_password => $service_password, + require => Class['::glance::api'] + } } diff --git a/manifests/glance/endpoint.pp b/manifests/glance/endpoint.pp deleted file mode 100644 index 06b486c..0000000 --- a/manifests/glance/endpoint.pp +++ /dev/null @@ -1,5 +0,0 @@ -class kickstack::glance::endpoint inherits kickstack { - - kickstack::endpoint { 'glance': } - -} diff --git a/manifests/keystone/api.pp b/manifests/keystone/api.pp index 20d0a5b..423758e 100644 --- a/manifests/keystone/api.pp +++ b/manifests/keystone/api.pp @@ -14,12 +14,27 @@ class kickstack::keystone::api inherits kickstack { sql_connection => $sql_conn, } + # Installs the service user endpoint. + class { '::keystone::endpoint': + public_address => "${hostname}${keystone_public_suffix}", + admin_address => "${hostname}${keystone_admin_suffix}", + internal_address => $hostname, + region => $keystone_region, + require => Class['::keystone'] + } + kickstack::exportfact::export { "keystone_admin_token": value => "${admin_token}", tag => "keystone", require => Class['::keystone'] } + kickstack::exportfact::export { "keystone_internal_address": + value => "${hostname}", + tag => "keystone", + require => Class['::keystone::endpoint'] + } + # Adds the admin credential to keystone. class { '::keystone::roles::admin': email => $kickstack::keystone_admin_email, diff --git a/manifests/keystone/endpoint.pp b/manifests/keystone/endpoint.pp deleted file mode 100644 index 785b01d..0000000 --- a/manifests/keystone/endpoint.pp +++ /dev/null @@ -1,21 +0,0 @@ -class kickstack::keystone::endpoint inherits kickstack { - # Grab the Keystone admin token from a kickstack fact and configure - # Keystone accordingly. If no fact has been set, generate a password. - $admin_token = pick(getvar("${fact_prefix}keystone_admin_token"),pwgen()) - - # Installs the service user endpoint. - class { '::keystone::endpoint': - public_address => "${hostname}${keystone_public_suffix}", - admin_address => "${hostname}${keystone_admin_suffix}", - internal_address => $hostname, - region => $keystone_region, - require => Class['::keystone'] - } - - kickstack::exportfact::export { "keystone_internal_address": - value => "${hostname}", - tag => "keystone", - require => Class['::keystone::endpoint'] - } - -} diff --git a/manifests/node/api.pp b/manifests/node/api.pp index 5f77818..910230a 100644 --- a/manifests/node/api.pp +++ b/manifests/node/api.pp @@ -1,10 +1,39 @@ class kickstack::node::api inherits kickstack { - include kickstack::glance::api - include kickstack::cinder::api + $keystone_internal_address = getvar("${fact_prefix}keystone_internal_address") + $glance_sql_conn = getvar("${fact_prefix}glance_sql_connection") + $cinder_sql_conn = getvar("${fact_prefix}cinder_sql_connection") + $quantum_sql_conn = getvar("${fact_prefix}quantum_sql_connection") + $nova_sql_conn = getvar("${fact_prefix}nova_sql_connection") + - include kickstack::quantum::server - include kickstack::quantum::plugin + case $::kickstack::rpc { + 'rabbitmq': { + $amqp_host = getvar("${::kickstack::fact_prefix}rabbit_host") + $amqp_password = getvar("${::kickstack::fact_prefix}rabbit_password") + } + 'qpid': { + $amqp_host = getvar("${::kickstack::fact_prefix}qpid_host") + $amqp_password = getvar("${::kickstack::fact_prefix}qpid_password") + } + } - include kickstack::nova::api + if $keystone_internal_address and $glance_sql_conn { + include kickstack::glance::api + } + + if $keystone_internal_address and $cinder_sql_conn and $amqp_host and $amqp_password { + include kickstack::cinder::api + } + + if $keystone_internal_address and $amqp_host and $amqp_password { + include kickstack::quantum::server + if $quantum_sql_conn { + include kickstack::quantum::plugin + } + } + + if $keystone_internal_address and $nova_sql_conn and $amqp_host and $amqp_password { + include kickstack::nova::api + } } diff --git a/manifests/node/auth.pp b/manifests/node/auth.pp index fab1300..3992e2d 100644 --- a/manifests/node/auth.pp +++ b/manifests/node/auth.pp @@ -1,8 +1,8 @@ class kickstack::node::auth inherits kickstack { - include kickstack::keystone::api - include kickstack::keystone::endpoint - include kickstack::glance::endpoint - include kickstack::cinder::endpoint - include kickstack::quantum::endpoint - include kickstack::nova::endpoint + + $keystone_sql_conn = getvar("${fact_prefix}keystone_sql_connection") + + if $keystone_sql_conn { + include kickstack::keystone::api + } } diff --git a/manifests/nova/api.pp b/manifests/nova/api.pp index 45d6fa0..1369b8a 100644 --- a/manifests/nova/api.pp +++ b/manifests/nova/api.pp @@ -3,11 +3,11 @@ class kickstack::nova::api inherits kickstack { include kickstack::nova::config include pwgen - # Grab the Keystone admin token from a kickstack fact and configure + # Grab the Keystone admin password from a kickstack fact and configure # Keystone accordingly. If no fact has been set, generate a password. - $admin_password = getvar("${fact_prefix}nova_keystone_password") + $admin_password = pick(getvar("${fact_prefix}nova_keystone_password"),pwgen()) $auth_host = getvar("${fact_prefix}keystone_internal_address") - $secret = pick(getvar("${fact_prefix}quantum_metadata_shared_secret"),pwgen()) + $quantum_secret = pick(getvar("${fact_prefix}quantum_metadata_shared_secret"),pwgen()) # Stupid hack: Grizzly packages in Ubuntu Cloud Archive # require python-eventlet > 0.9, but the python-nova @@ -24,7 +24,12 @@ class kickstack::nova::api inherits kickstack { admin_user => 'nova', admin_password => $admin_password, enabled_apis => 'ec2,osapi_compute,metadata', - quantum_metadata_proxy_shared_secret => $secret + quantum_metadata_proxy_shared_secret => $quantum_secret + } + + kickstack::endpoint { 'nova': + service_password => $admin_password, + require => Class['::nova::api'] } # Export the metadata API IP address and shared secret, to be picked up diff --git a/manifests/nova/endpoint.pp b/manifests/nova/endpoint.pp deleted file mode 100644 index 1e68edb..0000000 --- a/manifests/nova/endpoint.pp +++ /dev/null @@ -1,5 +0,0 @@ -class kickstack::nova::endpoint inherits kickstack { - - kickstack::endpoint { 'nova': } - -} diff --git a/manifests/quantum/endpoint.pp b/manifests/quantum/endpoint.pp deleted file mode 100644 index a8de362..0000000 --- a/manifests/quantum/endpoint.pp +++ /dev/null @@ -1,5 +0,0 @@ -class kickstack::quantum::endpoint inherits kickstack { - - kickstack::endpoint { 'quantum': } - -} diff --git a/manifests/quantum/server.pp b/manifests/quantum/server.pp index 3e3d512..72d88be 100644 --- a/manifests/quantum/server.pp +++ b/manifests/quantum/server.pp @@ -1,15 +1,21 @@ class kickstack::quantum::server inherits kickstack { include kickstack::quantum::config + include pwgen - $service_password = getvar("${fact_prefix}quantum_keystone_password") + $service_password = pick(getvar("${fact_prefix}quantum_keystone_password"),pwgen()) $keystone_internal_address = getvar("${fact_prefix}keystone_internal_address") class { '::quantum::server': auth_tenant => $kickstack::keystone_service_tenant, auth_user => 'quantum', auth_password => $service_password, - auth_host => $keystone_internal_address + auth_host => $keystone_internal_address, + } + + kickstack::endpoint { 'quantum': + service_password => $service_password, + require => Class['::quantum::server'] } kickstack::exportfact::export { "quantum_host":