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