Move endpoints into API definitions

This commit is contained in:
Florian Haas 2013-07-14 10:57:12 +00:00
parent 42c8e39d40
commit 7ec31b2b3b
13 changed files with 88 additions and 68 deletions

View File

@ -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']
}
}

View File

@ -1,5 +0,0 @@
class kickstack::cinder::endpoint inherits kickstack {
kickstack::endpoint { 'cinder': }
}

View File

@ -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'],
}

View File

@ -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']
}
}

View File

@ -1,5 +0,0 @@
class kickstack::glance::endpoint inherits kickstack {
kickstack::endpoint { 'glance': }
}

View File

@ -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,

View File

@ -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']
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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

View File

@ -1,5 +0,0 @@
class kickstack::nova::endpoint inherits kickstack {
kickstack::endpoint { 'nova': }
}

View File

@ -1,5 +0,0 @@
class kickstack::quantum::endpoint inherits kickstack {
kickstack::endpoint { 'quantum': }
}

View File

@ -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":