Added purge support in confd.

Added confd_purge option to tell it to purge files non managed by pupet in conf.d, default is false.

Because vhost_autogen it's not actually managed by puppet but indirectly created by a puppet executed
command, it's added as ignore to avoid getting it removed.

Better formating for confd purge support

Better formating for confd purge support
This commit is contained in:
Guzmán Brasó 2012-09-30 05:30:04 -03:00
parent e1363545ae
commit e9d984eaaf
3 changed files with 18 additions and 6 deletions

View file

@ -14,9 +14,10 @@
#
# This class file is not called directly
class nginx::config(
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$confd_purge = $nginx::params::nx_confd_purge,
) inherits nginx::params {
File {
owner => 'root',
@ -31,6 +32,14 @@ class nginx::config(
file { "${nginx::params::nx_conf_dir}/conf.d":
ensure => directory,
}
if $confd_purge == true {
File["${nginx::params::nx_conf_dir}/conf.d"] {
ignore => "vhost_autogen.conf",
purge => true,
recurse => true,
}
}
file { "${nginx::config::nx_run_dir}":
ensure => directory,

View file

@ -29,9 +29,10 @@
# include nginx
# }
class nginx (
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$confd_purge = $nginx::params::nx_confd_purge,
) inherits nginx::params {
include stdlib
@ -44,6 +45,7 @@ class nginx (
worker_processes => $worker_processes,
worker_connections => $worker_connections,
proxy_set_header => $proxy_set_header,
confd_purge => $confd_purge,
require => Class['nginx::package'],
notify => Class['nginx::service'],
}

View file

@ -18,6 +18,7 @@ class nginx::params {
$nx_run_dir = '/var/nginx'
$nx_conf_dir = '/etc/nginx'
$nx_confd_purge = false
$nx_worker_processes = 1
$nx_worker_connections = 1024
$nx_multi_accept = off