module-nginx/manifests/service.pp
Mickaël Canévet 29e327aa96 Fix typo
2015-04-07 10:56:15 +02:00

65 lines
1.4 KiB
Puppet

# Class: nginx::service
#
# This module manages NGINX service management and vhost rebuild
#
# Parameters:
#
# There are no default parameters for this class.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# This class file is not called directly
class nginx::service(
$configtest_enable = $::nginx::configtest_enable,
$service_restart = $::nginx::service_restart,
$service_ensure = $::nginx::service_ensure,
$service_name = 'nginx',
$service_flags = undef,
) {
$service_enable = $service_ensure ? {
running => true,
absent => false,
stopped => false,
'undef' => undef,
default => true,
}
if $service_ensure == 'undef' {
$service_ensure_real = undef
} else {
$service_ensure_real = $service_ensure
}
case $::osfamily {
'OpenBSD': {
service { 'nginx':
ensure => $service_ensure_real,
name => $service_name,
enable => $service_enable,
flags => $service_flags,
hasstatus => true,
hasrestart => true,
}
}
default: {
service { 'nginx':
ensure => $service_ensure_real,
name => $service_name,
enable => $service_enable,
hasstatus => true,
hasrestart => true,
}
}
}
if $configtest_enable == true {
Service['nginx'] {
restart => $service_restart,
}
}
}