0e7c4f0efe
The zaqar::server_instance resource type allows setting up multiple instances of zaqar-server by creating /etc/zaqar/{name}.conf . Currently there is no validation about the name and if it can be set to 'zaqar' which results in conflicting management of zaqar.conf . This change introduces a simple validation logic to make sure that the resource type uses a config file different from the base zaqar.conf . Change-Id: Idb0eaff24e84121e0c78daf659d5b9f861491faa
48 lines
1.1 KiB
Puppet
48 lines
1.1 KiB
Puppet
# = Class: zaqar::server_instance
|
|
#
|
|
# This class manages N instances of zaqar-server each using an
|
|
# alternate /etc/zaqar/n.conf file to control select service
|
|
# settings which take priority over settings in /etc/zaqar/zaqar.conf.
|
|
#
|
|
# [*transport*]
|
|
# Set to either 'wsgi' or 'websocket'. Required.
|
|
#
|
|
# [*enabled*]
|
|
# (Optional) Service enable state for zaqar-server.
|
|
# Defaults to true
|
|
#
|
|
define zaqar::server_instance(
|
|
$transport,
|
|
$enabled = true,
|
|
) {
|
|
|
|
if $name == 'zaqar' {
|
|
fail('The name should not be \'zaqar\'. Please use a different name')
|
|
}
|
|
|
|
include zaqar
|
|
include zaqar::deps
|
|
include zaqar::params
|
|
|
|
if $enabled {
|
|
$service_ensure = 'running'
|
|
} else {
|
|
$service_ensure = 'stopped'
|
|
}
|
|
|
|
file { "/etc/zaqar/${name}.conf":
|
|
ensure => file,
|
|
content => template('zaqar/zaqar.conf.erb'),
|
|
}
|
|
|
|
service { "${::zaqar::params::service_name}@${name}":
|
|
ensure => $service_ensure,
|
|
enable => $enabled,
|
|
tag => 'zaqar-service'
|
|
}
|
|
|
|
Package['zaqar-common'] ~> File["/etc/zaqar/${name}.conf"]
|
|
File["/etc/zaqar/${name}.conf"] ~> Service["${::zaqar::params::service_name}@${name}"]
|
|
|
|
}
|