+# The ceilometer::agent::compute class installs the ceilometer compute agent
+# Include this class on all nova compute nodes
+#
+# == Parameters
+# * auth_url: the keystone public endpoint
+# *auth_region: the keystone region of this compute node
+# *auth_user: the keystone user for ceilometer services
+# *auth_password: the keystone password for ceilometer services
+# *auth_tenant_name: the keystone tenant name for ceilometer services
+# *auth_tenant_id (optional): the keystone tenant id for ceilometer services
+# *enabled: should the service be started or not
#
class ceilometer::agent::compute (
$auth_url = 'http://localhost:5000/v2.0',
file_line {
'nova-notification-driver-common':
- line => 'notification_driver=nova.openstack.common.notifier.rabbit_notifier',
+ line =>
+ 'notification_driver=nova.openstack.common.notifier.rabbit_notifier',
path => '/etc/nova/nova.conf',
notify => Service['nova-compute'];
'nova-notification-driver-ceilometer':
+# Installs & configure the ceilometer api service
#
+# == Parameters
+# $enabled: should the service be enabled
+# Optional. Defaults to true
+# $keystone_host: keystone's admin endpoint IP/Host
+# Optional. Defaults to 127.0.0.1
+# $keystone_port: keystone's admin endpoint port
+# Optional. Defaults to 35357
+# $keystone_protocol: http/https
+# Optional. Defaults to https
+# $keytone_user: user to authenticate with
+# Optional. Defaults to ceilometer
+# $keystone_tenant: tenant to authenticate with
+# Optional. Defaults to services
+# $keystone_password: password to authenticate with
+# Mandatory.
class ceilometer::api (
$enabled = true,
$keystone_host = '127.0.0.1',
+# The ceilometer::db::mysql class creates a MySQL database for ceilometer.
+# It must be used on the MySQL server
+#
+# == Parameters
+#
+# $password: password to connect to the database
+# Mandatory.
+# $dbname: name of the database
+# Optional. Defaults to ceilometer.
+# $user: user to connect to the database
+# Optional. Defaults to ceilometer.
+# $host: the default source host user is allowed to connect from
+# Optional. Defaults to 'localhost'
+# $allowed_hosts: other hosts the user is allowd to connect from
+# Optional. Defaults to undef.
+# $charset: the database charset
+# Optional. Defaults to 'latin1'
+
class ceilometer::db::mysql(
- $password,
+ $password = undef,
$dbname = 'ceilometer',
$user = 'ceilometer',
$host = 'localhost',
Class['ceilometer::db::mysql'] -> Exec<| title == 'ceilometer-dbsync' |>
Mysql::Db[$dbname] ~> Exec<| title == 'ceilometer-dbsync' |>
+ #FIXME: ensure password is not empty
+
mysql::db { $dbname:
user => $user,
password => $password,
}
if $allowed_hosts {
- ceilometer::db::mysql::host_access { $allowed_hosts:
+ ceilometer::db::mysql::host_access { $allowed_hosts:
user => $user,
password => $password,
database => $dbname,
+# Allow a user to access the ceilometer database
+#
+# == Parameters
+# * namevar: the host to allow
+# * user: username to allow
+# * password: user password
+# * database: the database name
define ceilometer::db::mysql::host_access ($user, $password, $database) {
database_user { "${user}@${name}":
password_hash => mysql_password($password),
- provider => 'mysql',
- require => Database[$database],
+ provider => 'mysql',
+ require => Database[$database],
}
database_grant { "${user}@${name}/${database}":
# TODO figure out which privileges to grant.
- privileges => "all",
- provider => 'mysql',
- require => Database_user["${user}@${name}"]
+ privileges => 'all',
+ provider => 'mysql',
+ require => Database_user["${user}@${name}"]
}
}
+# Class ceilometer
#
-class ceilometer (
- $metering_secret,
+# ceilometer base package & configuration
+#
+# == parameters
+# $metering_secret: secret key for signing messages
+# Mandatory.
+# $package_ensure: ensure state for package.
+# Optional. Defaults to 'present'
+# $verbose: should the daemons log verbose messages
+# Optional. Defaults to 'False'
+# $debug: should the daemons log debug messages
+# Optional. Defaults to 'False'
+# $rabbit_host: ip or hostname of the rabbit server
+# Optional. Defaults to '127.0.0.1'
+# $rabbit_port: port of the rabbit server
+# Optional. Defaults to 5672.
+# $rabbit_hosts: array of host:port (used with HA queues)
+# Optional. Defaults to undef.
+# If defined, will remove rabbit_host & rabbit_port parameters from config
+# $rabbit_userid: user to connect to the rabbit server
+# Optional. Defaults to 'guest'
+# $rabbit_password: password to connect to the rabbit_server
+# Optional. Defaults to empty string.
+# $rabbit_virtualhost: virtualhost to use
+# Optional. Defaults to '/'
+#
+class ceilometer(
+ $metering_secret = undef,
$package_ensure = 'present',
$verbose = 'False',
$debug = 'False',
$rabbit_host = '127.0.0.1',
- $rabbit_hosts = undef,
$rabbit_port = 5672,
+ $rabbit_hosts = undef,
$rabbit_userid = 'guest',
$rabbit_password = '',
$rabbit_virtualhost = '/',
) {
+ #FIXME: ensure metering_secret is non-empty
+
include ceilometer::params
File {
if $rabbit_hosts {
ceilometer_config { 'DEFAULT/rabbit_host': ensure => absent }
ceilometer_config { 'DEFAULT/rabbit_port': ensure => absent }
- ceilometer_config { 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',') }
+ ceilometer_config { 'DEFAULT/rabbit_hosts':
+ value => join($rabbit_hosts, ',')
+ }
} else {
ceilometer_config { 'DEFAULT/rabbit_host': value => $rabbit_host }
ceilometer_config { 'DEFAULT/rabbit_port': value => $rabbit_port }
- ceilometer_config { 'DEFAULT/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
+ ceilometer_config { 'DEFAULT/rabbit_hosts':
+ value => "${rabbit_host}:${rabbit_port}"
+ }
}
if size($rabbit_hosts) > 1 {
- ceilometer_config { 'DEFAULT/rabbit_ha_queues': value => 'true' }
+ ceilometer_config { 'DEFAULT/rabbit_ha_queues': value => true }
} else {
- ceilometer_config { 'DEFAULT/rabbit_ha_queues': value => 'false' }
+ ceilometer_config { 'DEFAULT/rabbit_ha_queues': value => false }
}
ceilometer_config {
# Add glance-notifications topic.
# Fixed in glance https://github.com/openstack/glance/commit/2e0734e077ae
# Fix will be included in Grizzly
- 'DEFAULT/notification_topics' : value => 'notifications,glance_notifications';
+ 'DEFAULT/notification_topics' :
+ value => 'notifications,glance_notifications';
}
}
#
# == Parameters:
#
-# $auth_name :: identifier used for all keystone objects related to ceilometer.
-# Optional. Defaults to ceilometer.
-# $password :: password for ceilometer user. Optional. Defaults to glance_password.
-# $service_type :: type of service to create. Optional. Defaults to image.
-# $public_address :: Public address for endpoint. Optional. Defaults to 127.0.0.1.
-# $admin_address :: Admin address for endpoint. Optional. Defaults to 127.0.0.1.
-# $inernal_address :: Internal address for endpoint. Optional. Defaults to 127.0.0.1.
-# $port :: Port for endpoint. Needs to match ceilometer api service port. Optional.
-# Defaults to 8777.
-# $region :: Region where endpoint is set.
+# $password: ceilometer user's password
+# Mandatory
+# $email: ceilometer user's email
+# Optional.
+# $auth_name: username
+# Optional. Defaults to 'ceilometer'.
+# $service_type: type of service to create.
+# Optional. Defaults to 'metering'.
+# $public_address: Public address for endpoint.
+# Optional. Defaults to 127.0.0.1.
+# $admin_address: Admin address for endpoint.
+# Optional. Defaults to 127.0.0.1.
+# $internal_address: Internal address for endpoint.
+# Optional. Defaults to 127.0.0.1.
+# $port: Port for endpoint. Needs to match ceilometer api service port.
+# Optional. Defaults to 8777.
+# $region: Region where endpoint is set.
+# Optional. Defaults to 'RegionOne'.
+# $tenant: Service tenant name.
+# Optional. Defaults to 'services'.
+# $public_protocol: http/https.
+# Optional. Defaults to 'http'.
+# $configure_endpoint: should the endpoint be created in keystone ?
+# Optional. Defaults to true
#
class ceilometer::keystone::auth(
- $password,
+ $password = undef,
$email = 'ceilometer@localhost',
$auth_name = 'ceilometer',
- $configure_endpoint = true,
$service_type = 'metering',
$public_address = '127.0.0.1',
$admin_address = '127.0.0.1',
$port = '8777',
$region = 'RegionOne',
$tenant = 'services',
- $public_protocol = 'http'
+ $public_protocol = 'http',
+ $admin_protocol = 'http',
+ $internal_protocol = 'http',
+ $configure_endpoint = true
) {
- Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'ceilometer' |>
+ #FIXME: ensure $password is not empty
+
+ Keystone_user_role["${auth_name}@${tenant}"] ~>
+ Service <| name == 'ceilometer' |>
keystone_user { $auth_name:
ensure => present,
keystone_endpoint { "${region}/${auth_name}":
ensure => present,
public_url => "${public_protocol}://${public_address}:${port}",
- admin_url => "http://${admin_address}:${port}",
- internal_url => "http://${internal_address}:${port}",
+ admin_url => "${admin_protocol}://${admin_address}:${port}",
+ internal_url => "${internal_protocol}://${internal_address}:${port}",
}
}
}
-#
+# Parameters for puppet-ceilometer
class ceilometer::params {
- $dbsync_command = 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf'
+ $dbsync_command =
+ 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf'
$log_dir = '/var/log/ceilometer'
case $::osfamily {
}
}
default: {
- fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
+ fail("Unsupported osfamily: ${::osfamily} operatingsystem: \
+${::operatingsystem}, module ${module_name} only support osfamily \
+RedHat and Debian")
}
}
}