Add a new subclass (xymon::server::service) to manage the xymon server's
service.
This commit is contained in:
parent
05cc473245
commit
6e14a376e3
@ -46,6 +46,10 @@ class xymon::params {
|
||||
$srv_package_name = undef
|
||||
$srv_pkg_ensure = 'present'
|
||||
$srv_pkg_provider = 'dpkg'
|
||||
# Service
|
||||
$srv_service_enabled = true
|
||||
$srv_service_managed = true
|
||||
$srv_service_name = 'xymon'
|
||||
|
||||
# If the server subclass should manage the client one
|
||||
$manage_client = true
|
||||
|
@ -30,16 +30,19 @@ class xymon::server (
|
||||
$pkg_ensure = $xymon::params::srv_pkg_ensure,
|
||||
$pkg_provider = $xymon::params::srv_pkg_provider,
|
||||
$manage_client = $xymon::params::manage_client,
|
||||
$service_enabled = $xymon::params::srv_service_enabled,
|
||||
$service_managed = $xymon::params::srv_service_managed,
|
||||
$service_name = $xymon::params::srv_service_name,
|
||||
) inherits xymon::params {
|
||||
|
||||
include '::xymon::server::preconfig'
|
||||
include '::xymon::server::install'
|
||||
#include '::xymon::server::config'
|
||||
#include '::xymon::server::service'
|
||||
include '::xymon::server::service'
|
||||
|
||||
Class['::xymon::server::preconfig'] ->
|
||||
Class['::xymon::server::install']
|
||||
Class['::xymon::server::install'] ->
|
||||
#Class['::xymon::server::config'] ->
|
||||
#Class['::xymon::server::service']
|
||||
Class['::xymon::server::service']
|
||||
|
||||
} # Public class: xymon::server
|
||||
|
19
manifests/server/service.pp
Normal file
19
manifests/server/service.pp
Normal file
@ -0,0 +1,19 @@
|
||||
# Private class: xymon::server::service
|
||||
class xymon::server::service {
|
||||
|
||||
if $xymon::server::service_enabled == true {
|
||||
$service_ensure = running
|
||||
} else {
|
||||
$service_ensure = stopped
|
||||
}
|
||||
|
||||
if $xymon::server::service_managed == true {
|
||||
service { $xymon::server::service_name:
|
||||
ensure => $service_ensure,
|
||||
enable => $xymon::server::service_enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
}
|
||||
}
|
||||
|
||||
} # Private class: xymon::server::service
|
Loading…
Reference in New Issue
Block a user