2012-10-14 13:00:26 -07:00
|
|
|
#
|
|
|
|
# installs and configures nova api service
|
|
|
|
#
|
|
|
|
# * admin_password
|
|
|
|
# * enabled
|
|
|
|
# * ensure_package
|
|
|
|
# * auth_strategy
|
|
|
|
# * auth_host
|
|
|
|
# * auth_port
|
|
|
|
# * auth_protocol
|
2013-05-14 18:44:01 +02:00
|
|
|
# * auth_admin_prefix: path part of the auth url. Optional.
|
|
|
|
# This allow admin auth URIs like http://auth_host:35357/keystone/admin.
|
|
|
|
# (where '/keystone' is the admin prefix)
|
|
|
|
# Defaults to false for empty. If defined, should be a string with a leading '/' and no trailing '/'.
|
2012-10-14 13:00:26 -07:00
|
|
|
# * admin_tenant_name
|
|
|
|
# * admin_user
|
|
|
|
# * enabled_apis
|
2013-07-30 23:31:44 +00:00
|
|
|
# * use_forwarded_for:
|
|
|
|
# Treat X-Forwarded-For as the canonical remote address. Only
|
|
|
|
# enable this if you have a sanitizing proxy. (boolean value)
|
|
|
|
# (Optional). Defaults to false.
|
2013-05-03 12:46:59 +02:00
|
|
|
# * quantum_metadata_proxy_shared_secret
|
2012-10-14 13:00:26 -07:00
|
|
|
#
|
2012-04-01 14:23:36 -07:00
|
|
|
class nova::api(
|
2012-10-14 13:01:23 -07:00
|
|
|
$admin_password,
|
2012-04-23 17:46:17 -07:00
|
|
|
$enabled = false,
|
2012-05-08 13:32:36 -05:00
|
|
|
$ensure_package = 'present',
|
2012-04-23 17:46:17 -07:00
|
|
|
$auth_strategy = 'keystone',
|
|
|
|
$auth_host = '127.0.0.1',
|
|
|
|
$auth_port = 35357,
|
|
|
|
$auth_protocol = 'http',
|
2013-05-14 18:44:01 +02:00
|
|
|
$auth_admin_prefix = false,
|
2012-04-23 17:46:17 -07:00
|
|
|
$admin_tenant_name = 'services',
|
|
|
|
$admin_user = 'nova',
|
2012-10-14 20:39:26 +02:00
|
|
|
$api_bind_address = '0.0.0.0',
|
2013-05-09 12:16:15 -06:00
|
|
|
$metadata_listen = '0.0.0.0',
|
2012-11-16 04:54:53 -08:00
|
|
|
$enabled_apis = 'ec2,osapi_compute,metadata',
|
2012-11-28 22:17:22 -08:00
|
|
|
$volume_api_class = 'nova.volume.cinder.API',
|
2013-07-30 23:31:44 +00:00
|
|
|
$use_forwarded_for = false,
|
2013-04-26 06:17:03 -04:00
|
|
|
$workers = $::processorcount,
|
2013-05-03 12:46:59 +02:00
|
|
|
$sync_db = true,
|
|
|
|
$quantum_metadata_proxy_shared_secret = undef
|
2012-04-23 16:57:54 -07:00
|
|
|
) {
|
|
|
|
|
|
|
|
include nova::params
|
2012-11-06 12:07:54 -08:00
|
|
|
require keystone::python
|
2011-05-27 11:25:26 -07:00
|
|
|
|
2012-10-09 22:22:37 -07:00
|
|
|
Package<| title == 'nova-api' |> -> Nova_paste_api_ini<| |>
|
2012-04-07 19:32:13 -07:00
|
|
|
|
2012-11-06 12:07:54 -08:00
|
|
|
Package<| title == 'nova-common' |> -> Class['nova::api']
|
|
|
|
|
2012-10-09 22:22:37 -07:00
|
|
|
Nova_paste_api_ini<| |> ~> Exec['post-nova_config']
|
|
|
|
Nova_paste_api_ini<| |> ~> Service['nova-api']
|
2011-06-22 16:49:59 -07:00
|
|
|
|
2013-05-08 18:09:29 -04:00
|
|
|
class { 'cinder::client':
|
|
|
|
notify => Service[$::nova::params::api_service_name],
|
2012-11-02 13:31:58 -04:00
|
|
|
}
|
|
|
|
|
2012-04-01 14:23:36 -07:00
|
|
|
nova::generic_service { 'api':
|
2012-05-08 13:32:36 -05:00
|
|
|
enabled => $enabled,
|
|
|
|
ensure_package => $ensure_package,
|
|
|
|
package_name => $::nova::params::api_package_name,
|
|
|
|
service_name => $::nova::params::api_service_name,
|
2012-03-30 13:09:30 +02:00
|
|
|
}
|
|
|
|
|
2012-10-11 02:01:06 -07:00
|
|
|
nova_config {
|
2013-04-26 06:17:03 -04:00
|
|
|
'DEFAULT/api_paste_config': value => '/etc/nova/api-paste.ini';
|
|
|
|
'DEFAULT/enabled_apis': value => $enabled_apis;
|
|
|
|
'DEFAULT/volume_api_class': value => $volume_api_class;
|
|
|
|
'DEFAULT/ec2_listen': value => $api_bind_address;
|
|
|
|
'DEFAULT/osapi_compute_listen': value => $api_bind_address;
|
2013-05-09 12:16:15 -06:00
|
|
|
'DEFAULT/metadata_listen': value => $metadata_listen;
|
2013-04-26 06:17:03 -04:00
|
|
|
'DEFAULT/osapi_volume_listen': value => $api_bind_address;
|
|
|
|
'DEFAULT/osapi_compute_workers': value => $workers;
|
2013-07-30 23:31:44 +00:00
|
|
|
'DEFAULT/use_forwarded_for': value => $use_forwarded_for;
|
2012-10-11 02:01:06 -07:00
|
|
|
}
|
2012-04-08 22:40:50 +00:00
|
|
|
|
2013-05-03 12:46:59 +02:00
|
|
|
if ($quantum_metadata_proxy_shared_secret){
|
|
|
|
nova_config {
|
|
|
|
'DEFAULT/service_quantum_metadata_proxy': value => true;
|
|
|
|
'DEFAULT/quantum_metadata_proxy_shared_secret':
|
|
|
|
value => $quantum_metadata_proxy_shared_secret;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nova_config {
|
|
|
|
'DEFAULT/service_quantum_metadata_proxy': value => false;
|
|
|
|
'DEFAULT/quantum_metadata_proxy_shared_secret': ensure => absent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-09 22:22:37 -07:00
|
|
|
nova_paste_api_ini {
|
|
|
|
'filter:authtoken/auth_host': value => $auth_host;
|
|
|
|
'filter:authtoken/auth_port': value => $auth_port;
|
|
|
|
'filter:authtoken/auth_protocol': value => $auth_protocol;
|
|
|
|
'filter:authtoken/admin_tenant_name': value => $admin_tenant_name;
|
|
|
|
'filter:authtoken/admin_user': value => $admin_user;
|
2013-05-28 18:00:50 -04:00
|
|
|
'filter:authtoken/admin_password': value => $admin_password, secret => true;
|
2011-05-26 12:19:52 -07:00
|
|
|
}
|
2012-10-09 22:25:00 -07:00
|
|
|
|
2013-05-14 18:44:01 +02:00
|
|
|
if $auth_admin_prefix {
|
|
|
|
validate_re($auth_admin_prefix, '^(/.+[^/])?$')
|
|
|
|
nova_paste_api_ini {
|
|
|
|
'filter:authtoken/auth_admin_prefix': value => $auth_admin_prefix;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nova_paste_api_ini {
|
|
|
|
'filter:authtoken/auth_admin_prefix': ensure => absent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:39:26 +02:00
|
|
|
if 'occiapi' in $enabled_apis {
|
|
|
|
if !defined(Package['python-pip']) {
|
2013-05-08 18:09:29 -04:00
|
|
|
package { 'python-pip':
|
|
|
|
ensure => latest,
|
|
|
|
}
|
2012-10-14 20:39:26 +02:00
|
|
|
}
|
2013-05-08 18:09:29 -04:00
|
|
|
if !defined(Package['pyssf']) {
|
|
|
|
package { 'pyssf':
|
|
|
|
provider => pip,
|
|
|
|
ensure => latest,
|
|
|
|
require => Package['python-pip']
|
|
|
|
}
|
2012-10-14 20:39:26 +02:00
|
|
|
}
|
2013-05-08 18:09:29 -04:00
|
|
|
package { 'openstackocci':
|
|
|
|
provider => 'pip',
|
|
|
|
ensure => latest,
|
|
|
|
require => Package['python-pip'],
|
2012-10-14 20:39:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:09:29 -04:00
|
|
|
# Added arg and if statement prevents this from being run
|
|
|
|
# where db is not active i.e. the compute
|
2012-11-28 22:17:22 -08:00
|
|
|
if $sync_db {
|
|
|
|
Package<| title == 'nova-api' |> -> Exec['nova-db-sync']
|
2013-05-08 18:09:29 -04:00
|
|
|
exec { 'nova-db-sync':
|
|
|
|
command => '/usr/bin/nova-manage db sync',
|
|
|
|
refreshonly => true,
|
2012-11-28 22:17:22 -08:00
|
|
|
subscribe => Exec['post-nova_config'],
|
|
|
|
}
|
2012-10-09 22:25:00 -07:00
|
|
|
}
|
|
|
|
|
2011-05-26 12:19:52 -07:00
|
|
|
}
|