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(
|
2013-04-24 10:42:06 +02:00
|
|
|
$configtest_enable = $nginx::params::nx_configtest_enable,
|
|
|
|
$service_restart = $nginx::params::nx_service_restart
|
2012-09-30 22:29:55 +02:00
|
|
|
) {
|
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,
|
2013-04-24 10:42:06 +02:00
|
|
|
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"],
|
|
|
|
}
|
add support for mail module
See http://wiki.nginx.org/Modules#Mail_modules
Sample Usage:
nginx::resource::mailhost { 'domain1.example':
ensure => present,
auth_http => 'server2.example/cgi-bin/auth',
protocol => 'smtp',
listen_port => 587,
ssl_port => 465,
starttls => 'only',
xclient => 'off',
ssl => 'true',
ssl_cert => '/tmp/server.crt',
ssl_key => '/tmp/server.pem',
}
2013-03-11 14:05:00 +01:00
|
|
|
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,
|
2013-04-24 10:42:06 +02:00
|
|
|
unless => "/usr/bin/test ! -f ${nginx::params::nx_temp_dir}/nginx.mail.d/*",
|
add support for mail module
See http://wiki.nginx.org/Modules#Mail_modules
Sample Usage:
nginx::resource::mailhost { 'domain1.example':
ensure => present,
auth_http => 'server2.example/cgi-bin/auth',
protocol => 'smtp',
listen_port => 587,
ssl_port => 465,
starttls => 'only',
xclient => 'off',
ssl => 'true',
ssl_cert => '/tmp/server.crt',
ssl_key => '/tmp/server.pem',
}
2013-03-11 14:05:00 +01:00
|
|
|
subscribe => File["${nginx::params::nx_temp_dir}/nginx.mail.d"],
|
|
|
|
}
|
2013-05-08 14:15:42 +02:00
|
|
|
service { 'nginx':
|
2011-05-25 04:20:48 +02:00
|
|
|
ensure => running,
|
2011-06-15 19:16:30 +02:00
|
|
|
enable => true,
|
2011-05-25 04:20:48 +02:00
|
|
|
hasstatus => true,
|
2011-06-15 21:40:42 +02:00
|
|
|
hasrestart => true,
|
add support for mail module
See http://wiki.nginx.org/Modules#Mail_modules
Sample Usage:
nginx::resource::mailhost { 'domain1.example':
ensure => present,
auth_http => 'server2.example/cgi-bin/auth',
protocol => 'smtp',
listen_port => 587,
ssl_port => 465,
starttls => 'only',
xclient => 'off',
ssl => 'true',
ssl_cert => '/tmp/server.crt',
ssl_key => '/tmp/server.pem',
}
2013-03-11 14:05:00 +01:00
|
|
|
subscribe => Exec['rebuild-nginx-vhosts', 'rebuild-nginx-mailhosts'],
|
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
|
|
|
}
|