puppet-zaqar/manifests/server_instance.pp
ZhongShengping c54428f524 Add hooks for external install & svc management
This adds defined anchor points for external modules to hook into the
software install, config and service dependency chain.  This allows
external modules to manage software installation (virtualenv,
containers, etc) and service management (pacemaker) without needing rely
on resources that may change or be renamed.

Change-Id: If4f585264f5f5a15549855d97b532866d91f5215
2016-12-07 16:49:58 +08:00

44 lines
1.0 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,
) {
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}"]
}