1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-12-16 05:10:36 +00:00

added generic fluentd::config::file resource

this is used to create config files for sources, matches and filters.
This commit is contained in:
Max Wilhelm 2015-12-01 13:28:51 +01:00
parent 2a35866e27
commit b79c8bfd25

31
manifests/config/file.pp Normal file
View File

@ -0,0 +1,31 @@
# Configure a fluentd config file
# e.g. source, match etc.
#
define fluentd::config::file (
$ensure = present,
$priority = 50,
$content,
) {
$base_name = "${title}.conf"
$config_name = "${priority}-${base_name}"
$base_path = "/etc/td-agent/conf.d"
$config_path = "${base_path}/${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}",
before => File[$config_path],
notify => Class['fluentd::service'],
}
file { $config_path:
ensure => $ensure,
content => $content,
owner => 'td-agent',
group => 'td-agent',
mode => '0644',
notify => Class['fluentd::service'],
}
}