Possibility to detach ceilometer from controllers

Adds the possibility to use external (non-controllers) keystone,
db, rabbitmq, etc for ceilometer services.

Partial blueprint: detach-components-from-controllers

Change-Id: I670ac5c535b43bb2d8cf95209e3a9ea772d1dd6c
Co-Authored-By: Aleksandr Didenko <adidenko@mirantis.com>
This commit is contained in:
Mykyta Koshykov 2015-06-03 09:13:11 -05:00 committed by Alex Schultz
parent 8f461c2264
commit 7b060f0b36
3 changed files with 58 additions and 25 deletions

View File

@ -6,6 +6,9 @@
class openstack::ceilometer ( class openstack::ceilometer (
$keystone_password = 'ceilometer_pass', $keystone_password = 'ceilometer_pass',
$keystone_user = 'ceilometer',
$keystone_tenant = 'services',
$keystone_region = 'RegionOne',
$metering_secret = 'ceilometer', $metering_secret = 'ceilometer',
$verbose = false, $verbose = false,
$use_syslog = false, $use_syslog = false,
@ -50,8 +53,11 @@ class openstack::ceilometer (
# Configure authentication for agents # Configure authentication for agents
class { '::ceilometer::agent::auth': class { '::ceilometer::agent::auth':
auth_url => "http://${keystone_host}:5000/v2.0", auth_url => "http://${keystone_host}:5000/v2.0",
auth_password => $keystone_password, auth_password => $keystone_password,
auth_region => $keystone_region,
auth_tenant_name => $keystone_tenant,
auth_user => $keystone_user,
} }
class { '::ceilometer::client': } class { '::ceilometer::client': }
@ -89,10 +95,12 @@ class openstack::ceilometer (
# Install the ceilometer-api service # Install the ceilometer-api service
# The keystone_password parameter is mandatory # The keystone_password parameter is mandatory
class { '::ceilometer::api': class { '::ceilometer::api':
keystone_host => $keystone_host, keystone_host => $keystone_host,
keystone_password => $keystone_password, keystone_user => $keystone_user,
host => $host, keystone_password => $keystone_password,
port => $port, keystone_tenant => $keystone_tenant,
host => $host,
port => $port,
} }
# Clean up expired data once a week # Clean up expired data once a week

View File

@ -4,7 +4,6 @@ $verbose = hiera('verbose', true)
$debug = hiera('debug', false) $debug = hiera('debug', false)
$use_syslog = hiera('use_syslog', true) $use_syslog = hiera('use_syslog', true)
$syslog_log_facility = hiera('syslog_log_facility_ceilometer', 'LOG_LOCAL0') $syslog_log_facility = hiera('syslog_log_facility_ceilometer', 'LOG_LOCAL0')
$amqp_hosts = hiera('amqp_hosts')
$rabbit_hash = hiera('rabbit_hash') $rabbit_hash = hiera('rabbit_hash')
$management_vip = hiera('management_vip') $management_vip = hiera('management_vip')
@ -15,8 +14,17 @@ $default_ceilometer_hash = {
'metering_secret' => 'ceilometer', 'metering_secret' => 'ceilometer',
} }
$ceilometer_hash = hiera('ceilometer', $default_ceilometer_hash) if hiera('amqp_hosts', false) {
$amqp_hosts = hiera('amqp_hosts')
} else {
$amqp_nodes = hiera('amqp_nodes')
$amqp_port = hiera('amqp_port', '5673')
$amqp_hosts = inline_template("<%= @amqp_nodes.map {|x| x + ':' + @amqp_port}.join ',' %>")
}
$region = hiera('region', 'RegionOne')
$ceilometer_hash = hiera_hash('ceilometer', $default_ceilometer_hash)
$ceilometer_region = pick($ceilometer_hash['region'], $region)
$ceilometer_enabled = $ceilometer_hash['enabled'] $ceilometer_enabled = $ceilometer_hash['enabled']
$amqp_password = $rabbit_hash['password'] $amqp_password = $rabbit_hash['password']
$amqp_user = $rabbit_hash['user'] $amqp_user = $rabbit_hash['user']
@ -33,6 +41,9 @@ if ($ceilometer_enabled) {
amqp_hosts => $amqp_hosts, amqp_hosts => $amqp_hosts,
amqp_user => $amqp_user, amqp_user => $amqp_user,
amqp_password => $amqp_password, amqp_password => $amqp_password,
keystone_user => $ceilometer_hash['user'],
keystone_tenant => $ceilometer_hash['tenant'],
keystone_region => $ceilometer_region,
keystone_host => $service_endpoint, keystone_host => $service_endpoint,
keystone_password => $ceilometer_user_password, keystone_password => $ceilometer_user_password,
on_compute => true, on_compute => true,

View File

@ -1,15 +1,12 @@
notice('MODULAR: ceilometer/controller.pp') notice('MODULAR: ceilometer/controller.pp')
$verbose = hiera('verbose', true) if hiera('amqp_hosts', false) {
$debug = hiera('debug', false) $amqp_hosts = hiera('amqp_hosts')
$use_syslog = hiera('use_syslog', true) } else {
$syslog_log_facility = hiera('syslog_log_facility_ceilometer', 'LOG_LOCAL0') $amqp_nodes = hiera('amqp_nodes')
$nodes_hash = hiera('nodes') $amqp_port = hiera('amqp_port', '5673')
$storage_hash = hiera('storage') $amqp_hosts = inline_template("<%= @amqp_nodes.map {|x| x + ':' + @amqp_port}.join ',' %>")
$amqp_hosts = hiera('amqp_hosts') }
$rabbit_hash = hiera('rabbit_hash')
$management_vip = hiera('management_vip')
$internal_address = hiera('internal_address')
$default_ceilometer_hash = { $default_ceilometer_hash = {
'enabled' => false, 'enabled' => false,
@ -18,15 +15,29 @@ $default_ceilometer_hash = {
'metering_secret' => 'ceilometer', 'metering_secret' => 'ceilometer',
} }
$verbose = hiera('verbose', true)
$debug = hiera('debug', false)
$use_syslog = hiera('use_syslog', true)
$syslog_log_facility = hiera('syslog_log_facility_ceilometer', 'LOG_LOCAL0')
$nodes_hash = hiera('nodes')
$storage_hash = hiera('storage')
$rabbit_hash = hiera_hash('rabbit_hash')
$management_vip = hiera('management_vip')
$internal_address = hiera('internal_address')
$mongo_roles = hiera('mongo_roles', 'mongo')
$region = hiera('region', 'RegionOne')
$ceilometer_hash = hiera_hash('ceilometer', $default_ceilometer_hash)
$ceilometer_region = pick($ceilometer_hash['region'], $region)
$default_mongo_hash = { $default_mongo_hash = {
'enabled' => false, 'enabled' => false,
} }
$ceilometer_hash = hiera('ceilometer', $default_ceilometer_hash) $mongo_hash = hiera_hash('mongo', $default_mongo_hash)
$mongo_hash = hiera('mongo', $default_mongo_hash)
if $mongo_hash['enabled'] and $ceilometer_hash['enabled'] { if $mongo_hash['enabled'] and $ceilometer_hash['enabled'] {
$exteranl_mongo_hash = hiera('external_mongo') $exteranl_mongo_hash = hiera_hash('external_mongo')
$ceilometer_db_user = $exteranl_mongo_hash['mongo_user'] $ceilometer_db_user = $exteranl_mongo_hash['mongo_user']
$ceilometer_db_password = $exteranl_mongo_hash['mongo_password'] $ceilometer_db_password = $exteranl_mongo_hash['mongo_password']
$ceilometer_db_dbname = $exteranl_mongo_hash['mongo_db_name'] $ceilometer_db_dbname = $exteranl_mongo_hash['mongo_db_name']
@ -47,9 +58,9 @@ $swift_rados_backend = $storage_hash['objects_ceph']
$amqp_password = $rabbit_hash['password'] $amqp_password = $rabbit_hash['password']
$amqp_user = $rabbit_hash['user'] $amqp_user = $rabbit_hash['user']
$rabbit_ha_queues = true $rabbit_ha_queues = true
$service_endpoint = $management_vip $service_endpoint = hiera('service_endpoint', $management_vip)
$api_bind_address = $internal_address $api_bind_address = $internal_address
$ha_mode = true $ha_mode = pick($ceilometer_hash['ha_mode'], true)
if $ceilometer_hash['enabled'] { if $ceilometer_hash['enabled'] {
if $external_mongo { if $external_mongo {
@ -60,8 +71,8 @@ if $ceilometer_hash['enabled'] {
$mongo_replicaset = undef $mongo_replicaset = undef
} }
} else { } else {
$mongo_hosts = mongo_hosts($nodes_hash) $mongo_hosts = mongo_hosts($nodes_hash, 'string', $mongo_roles )
if size(mongo_hosts($nodes_hash, 'array', 'mongo')) > 1 { if size(mongo_hosts($nodes_hash, 'array', $mongo_roles)) > 1 {
$mongo_replicaset = 'ceilometer' $mongo_replicaset = 'ceilometer'
} else { } else {
$mongo_replicaset = undef $mongo_replicaset = undef
@ -90,6 +101,9 @@ if ($ceilometer_enabled) {
rabbit_ha_queues => $rabbit_ha_queues, rabbit_ha_queues => $rabbit_ha_queues,
keystone_host => $service_endpoint, keystone_host => $service_endpoint,
keystone_password => $ceilometer_user_password, keystone_password => $ceilometer_user_password,
keystone_user => $ceilometer_hash['user'],
keystone_tenant => $ceilometer_hash['tenant'],
keystone_region => $ceilometer_region,
host => $api_bind_address, host => $api_bind_address,
ha_mode => $ha_mode, ha_mode => $ha_mode,
on_controller => true, on_controller => true,