2011-06-07 01:05:27 +02:00
|
|
|
# Class: nginx::service
|
|
|
|
#
|
|
|
|
# This module manages NGINX service management and vhost rebuild
|
|
|
|
#
|
|
|
|
# Parameters:
|
2011-06-15 21:40:42 +02:00
|
|
|
#
|
|
|
|
# There are no default parameters for this class.
|
2011-06-07 01:05:27 +02:00
|
|
|
#
|
|
|
|
# Actions:
|
|
|
|
#
|
|
|
|
# Requires:
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
#
|
|
|
|
# This class file is not called directly
|
2012-09-30 22:29:55 +02:00
|
|
|
class nginx::service(
|
2014-03-04 17:46:45 +01:00
|
|
|
$configtest_enable = $nginx::configtest_enable,
|
|
|
|
$service_restart = $nginx::service_restart,
|
|
|
|
$service_ensure = $nginx::service_ensure,
|
2012-09-30 22:29:55 +02:00
|
|
|
) {
|
2014-03-30 13:23:43 +02:00
|
|
|
|
2014-03-03 19:23:41 +01:00
|
|
|
$service_enable = $service_ensure ? {
|
|
|
|
running => true,
|
|
|
|
absent => false,
|
|
|
|
stopped => false,
|
2014-05-25 12:03:53 +02:00
|
|
|
'undef' => undef,
|
2014-03-03 19:23:41 +01:00
|
|
|
default => true,
|
|
|
|
}
|
2014-01-06 22:27:57 +01:00
|
|
|
|
2014-05-25 12:03:53 +02:00
|
|
|
if $service_ensure == 'undef' {
|
|
|
|
$service_ensure_real = undef
|
|
|
|
} else {
|
|
|
|
$service_ensure_real = $service_ensure
|
|
|
|
}
|
|
|
|
|
2013-05-08 14:15:42 +02:00
|
|
|
service { 'nginx':
|
2014-05-25 12:03:53 +02:00
|
|
|
ensure => $service_ensure_real,
|
2014-03-03 19:23:41 +01:00
|
|
|
enable => $service_enable,
|
2011-05-25 04:20:48 +02:00
|
|
|
hasstatus => true,
|
2011-06-15 21:40:42 +02:00
|
|
|
hasrestart => true,
|
2011-05-25 04:20:48 +02:00
|
|
|
}
|
2012-09-30 22:29:55 +02:00
|
|
|
if $configtest_enable == true {
|
2013-05-08 14:15:42 +02:00
|
|
|
Service['nginx'] {
|
2012-09-30 22:29:55 +02:00
|
|
|
restart => $service_restart,
|
|
|
|
}
|
|
|
|
}
|
2011-06-15 21:40:42 +02:00
|
|
|
}
|