From c8046ee2c67f5d8136a9742567ab4077d344a7f6 Mon Sep 17 00:00:00 2001 From: Luca Zecca Date: Mon, 24 Jul 2017 14:33:21 +0200 Subject: [PATCH] added boolean param for enabling fluentd::conf_dir exclusive file handling by puppet. --- manifests/config.pp | 10 ++++++---- manifests/init.pp | 4 ++++ manifests/params.pp | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index a50e69a..67e08d0 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -11,9 +11,11 @@ class fluentd::config inherits fluentd { } file { $::fluentd::conf_dir: - ensure => 'directory', - owner => $::fluentd::user_name, - group => $::fluentd::user_group, - mode => '0750', + ensure => 'directory', + recurse => $::fluentd::params::conf_dir_manage, + purge => $::fluentd::params::conf_dir_manage, + owner => $::fluentd::user_name, + group => $::fluentd::user_group, + mode => '0750', } } diff --git a/manifests/init.pp b/manifests/init.pp index 4199af6..ef96e60 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,6 +8,9 @@ # [*repo_manage*] # Include repository to install recent fluentd (td-agent) from # Default: 'true' +# [*conf_dir_manage*] +# Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted +# Default: 'false' # [*package_ensure*] # Package ensure # Default: 'installed' @@ -63,6 +66,7 @@ class fluentd ( $service_enable = $::fluentd::params::service_enable, $config_path = $::fluentd::params::config_path, $conf_dir = $::fluentd::params::conf_dir, + $conf_dir_manage = $::fluentd::params::conf_dir_manage, $config_file = $::fluentd::params::config_file, $user_manage = $::fluentd::params::user_manage, $user_name = $::fluentd::params::user_name, diff --git a/manifests/params.pp b/manifests/params.pp index eb43e22..cd01efe 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -11,6 +11,7 @@ class fluentd::params { # config params $config_path = '/etc/td-agent' $conf_dir = "${config_path}/conf.d" + $conf_dir_manage = false $config_file = "${config_path}/td-agent.conf" # user params $user_manage = true