From e9d984eaafef0806c0b0420f1e195abc427b88ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guzm=C3=A1n=20Bras=C3=B3?= Date: Sun, 30 Sep 2012 05:30:04 -0300 Subject: [PATCH] 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 --- manifests/config.pp | 15 ++++++++++++--- manifests/init.pp | 8 +++++--- manifests/params.pp | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 25c96f9..e69a9cc 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -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, diff --git a/manifests/init.pp b/manifests/init.pp index d117f51..97ada02 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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'], } diff --git a/manifests/params.pp b/manifests/params.pp index b5c3a6a..00a7f81 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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