puppet-ceilometer/manifests/agent/central.pp
Yanis Guenane a5353006ef Add tag to package and service resources
In order to be able to take an action after all the packages of the
module have been installed/updated or all the services have been
started/restarted, we set a 'ceilometer-package' and 'ceilometer-service'
tag for each package and service of this module.

At the moment, there is a generic openstack tag that is not specific
enough if one wants to take action upon a single module change.

Use case :

If an action needs to be taken after all the packages have been
installed or updated : Package <| tag == 'ceilometer-package' |> -> X

Change-Id: I5e96d99e4ee10bbac73678c85eb1e8db390774b8
2015-07-22 21:00:51 +02:00

62 lines
1.6 KiB
Puppet

# Installs/configures the ceilometer central agent
#
# == Parameters
# [*enabled*]
# (optional) Should the service be enabled.
# Defaults to true.
#
# [*manage_service*]
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
# [*coordination_url*]
# (optional) The url to use for distributed group membership coordination.
# Defaults to undef.
#
class ceilometer::agent::central (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$coordination_url = undef,
) {
include ::ceilometer::params
Ceilometer_config<||> ~> Service['ceilometer-agent-central']
Package['ceilometer-agent-central'] -> Service['ceilometer-agent-central']
package { 'ceilometer-agent-central':
ensure => $package_ensure,
name => $::ceilometer::params::agent_central_package_name,
tag => ['openstack', 'ceilometer-package'],
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
Package['ceilometer-common'] -> Service['ceilometer-agent-central']
service { 'ceilometer-agent-central':
ensure => $service_ensure,
name => $::ceilometer::params::agent_central_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => 'ceilometer-service',
}
if $coordination_url {
ensure_resource('ceilometer_config', 'coordination/backend_url',
{'value' => $coordination_url})
}
}