mirror of
https://github.com/krislamo/puppet-fluentd
synced 2024-12-16 05:10:36 +00:00
parameterized config path, dir, file and user/group
This commit is contained in:
parent
43cfae7797
commit
9d2175411b
@ -2,7 +2,7 @@
|
||||
#
|
||||
class fluentd::config inherits fluentd {
|
||||
|
||||
file { '/etc/td-agent/td-agent.conf' :
|
||||
file { $config_file:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
@ -10,10 +10,10 @@ class fluentd::config inherits fluentd {
|
||||
notify => Class['Fluentd::Service'],
|
||||
}
|
||||
|
||||
file {'/etc/td-agent/conf.d':
|
||||
file { $conf_dir:
|
||||
ensure => 'directory',
|
||||
owner => 'td-agent',
|
||||
group => 'td-agent',
|
||||
owner => $user_name,
|
||||
group => $user_group,
|
||||
mode => '0750',
|
||||
}
|
||||
|
||||
|
@ -13,13 +13,12 @@ define fluentd::config::file (
|
||||
|
||||
$base_name = "${title}.conf"
|
||||
$config_name = "${priority}-${base_name}"
|
||||
$base_path = "/etc/td-agent/conf.d"
|
||||
$config_path = "${base_path}/${config_name}"
|
||||
$config_path = "${::fluentd::conf_dir}/${config_name}"
|
||||
|
||||
# clean up to ensure priority changes take effect
|
||||
exec { "apply priority change for ${base_name}":
|
||||
command => "rm ${base_path}/*-${base_name}",
|
||||
onlyif => "ls ${base_path}/*-${base_name} | grep -v ${config_name}",
|
||||
command => "rm ${::fluentd::conf_dir}/*-${base_name}",
|
||||
onlyif => "ls ${::fluentd::conf_dir}/*-${base_name} | grep -v ${config_name}",
|
||||
before => File[$config_path],
|
||||
notify => Class['Fluentd::Service'],
|
||||
}
|
||||
|
@ -49,6 +49,11 @@ class fluentd (
|
||||
$service_name = $::fluentd::params::service_name,
|
||||
$service_ensure = $::fluentd::params::service_ensure,
|
||||
$service_enable = $::fluentd::params::service_enable,
|
||||
$config_path = $::fluentd::params::config_path,
|
||||
$conf_dir = $::fluentd::params::conf_dir,
|
||||
$config_file = $::fluentd::params::config_file,
|
||||
$user_name = $::fluentd::params::user_name,
|
||||
$user_group = $::fluentd::params::user_group,
|
||||
) inherits fluentd::params {
|
||||
|
||||
# parameter validation
|
||||
|
@ -8,6 +8,13 @@ class fluentd::params {
|
||||
$service_name = 'td-agent'
|
||||
$service_ensure = 'running'
|
||||
$service_enable = true
|
||||
# config params
|
||||
$config_path = '/etc/td-agent'
|
||||
$conf_dir = "${config_path}/conf.d"
|
||||
$config_file = "${config_path}/td-agent.conf"
|
||||
# user params
|
||||
$user_name = 'td-agent'
|
||||
$user_group = 'td-agent'
|
||||
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
|
@ -9,10 +9,10 @@ define fluentd::plugin::file (
|
||||
fail("Use of private fluentd::plugin::file by ${caller_module_name}")
|
||||
}
|
||||
|
||||
file { "/etc/td-agent/plugin/${name}":
|
||||
file { "${::fluentd::config_path}/plugin/${name}":
|
||||
ensure => $ensure,
|
||||
owner => 'td-agent',
|
||||
group => 'td-agent',
|
||||
owner => $::fluentd::user_name,
|
||||
group => $::fluentd::user_group,
|
||||
mode => '0640',
|
||||
source => $source,
|
||||
notify => Class['Fluentd::Service']
|
||||
|
Loading…
Reference in New Issue
Block a user