module-nginx/manifests/service.pp

45 lines
1.4 KiB
ObjectPascal
Raw Normal View History

2011-06-07 01:05:27 +02:00
# Class: nginx::service
#
# This module manages NGINX service management and vhost rebuild
#
# Parameters:
#
# 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
class nginx::service(
$configtest_enable = $nginx::params::nx_configtest_enable,
$service_restart = $nginx::params::nx_service_restart
) {
2011-06-07 00:25:04 +02:00
exec { 'rebuild-nginx-vhosts':
command => "/bin/cat ${nginx::params::nx_temp_dir}/nginx.d/* > ${nginx::params::nx_conf_dir}/conf.d/vhost_autogen.conf",
refreshonly => true,
unless => "/usr/bin/test ! -f ${nginx::params::nx_temp_dir}/nginx.d/*",
2011-06-07 00:25:04 +02:00
subscribe => File["${nginx::params::nx_temp_dir}/nginx.d"],
}
exec { 'rebuild-nginx-mailhosts':
command => "/bin/cat ${nginx::params::nx_temp_dir}/nginx.mail.d/* > ${nginx::params::nx_conf_dir}/conf.mail.d/vhost_autogen.conf",
refreshonly => true,
unless => "/usr/bin/test ! -f ${nginx::params::nx_temp_dir}/nginx.mail.d/*",
subscribe => File["${nginx::params::nx_temp_dir}/nginx.mail.d"],
}
2011-05-25 04:20:48 +02:00
service { "nginx":
ensure => running,
enable => true,
2011-05-25 04:20:48 +02:00
hasstatus => true,
hasrestart => true,
subscribe => Exec['rebuild-nginx-vhosts', 'rebuild-nginx-mailhosts'],
2011-05-25 04:20:48 +02:00
}
if $configtest_enable == true {
Service["nginx"] {
restart => $service_restart,
}
}
}