puppet-cinder/manifests/scheduler.pp
Yanis Guenane 69bfb7cb81 Rely on autorequire for config resource ordering
Currently we specify the ordering of config resources wherever it is
necessary based on the presence of the file it will write to, or the
presence of the package in charge of providing the file it will write
to.

Those kind of ordering can be specified directly at the resource level
using the autorequire mechanism. With this patch, any config resource
will make sure the package in charge of providing the file will be
installed first.

Change-Id: I42bc4700302b4c3141345fe442168771c079f712
2015-08-12 18:54:38 +02:00

73 lines
1.6 KiB
Puppet

# == Class: cinder::scheduler
#
# Scheduler class for cinder.
#
# === Parameters
#
# [*scheduler_driver*]
# (Optional) Default scheduler driver to use
# Defaults to 'false'.
#
# [*package_ensure*]
# (Optioanl) The state of the package.
# Defaults to 'present'.
#
# [*enabled*]
# (Optional) The state of the service
# Defaults to 'true'.
#
# [*manage_service*]
# (Optional) Whether to start/stop the service
# Defaults to 'true'.
#
#
class cinder::scheduler (
$scheduler_driver = false,
$package_ensure = 'present',
$enabled = true,
$manage_service = true
) {
include ::cinder::params
Cinder_config<||> ~> Service['cinder-scheduler']
Cinder_api_paste_ini<||> ~> Service['cinder-scheduler']
Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-scheduler']
if $scheduler_driver {
cinder_config {
'DEFAULT/scheduler_driver': value => $scheduler_driver;
}
} else {
cinder_config {
'DEFAULT/scheduler_driver': ensure => absent;
}
}
if $::cinder::params::scheduler_package {
Package['cinder-scheduler'] -> Service['cinder-scheduler']
package { 'cinder-scheduler':
ensure => $package_ensure,
name => $::cinder::params::scheduler_package,
tag => ['openstack', 'cinder-package'],
}
}
if $manage_service {
if $enabled {
$ensure = 'running'
} else {
$ensure = 'stopped'
}
}
service { 'cinder-scheduler':
ensure => $ensure,
name => $::cinder::params::scheduler_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
tag => 'cinder-service',
}
}