2015-12-01 12:28:51 +00:00
|
|
|
# Configure a fluentd config file
|
|
|
|
# e.g. source, match etc.
|
|
|
|
#
|
|
|
|
define fluentd::config::file (
|
|
|
|
$ensure = present,
|
|
|
|
$priority = 50,
|
2015-12-01 13:18:06 +00:00
|
|
|
$content = undef,
|
2015-12-01 12:28:51 +00:00
|
|
|
) {
|
|
|
|
|
2015-12-01 14:29:53 +00:00
|
|
|
if $caller_module_name != $module_name {
|
|
|
|
fail("Use of private fluentd::config::file by ${caller_module_name}")
|
|
|
|
}
|
|
|
|
|
2015-12-01 12:28:51 +00:00
|
|
|
$base_name = "${title}.conf"
|
|
|
|
$config_name = "${priority}-${base_name}"
|
2015-12-04 13:20:11 +00:00
|
|
|
$config_path = "${::fluentd::conf_dir}/${config_name}"
|
2015-12-01 12:28:51 +00:00
|
|
|
|
|
|
|
# clean up to ensure priority changes take effect
|
|
|
|
exec { "apply priority change for ${base_name}":
|
2016-01-15 20:35:19 +00:00
|
|
|
path => '/bin:/usr/bin:/usr/local/bin',
|
2016-01-26 21:38:44 +00:00
|
|
|
cwd => $::fluentd::conf_dir,
|
2016-01-15 20:35:19 +00:00
|
|
|
command => "rm *-${base_name}",
|
|
|
|
onlyif => "ls *-${base_name} | grep -v ${config_name}",
|
2015-12-01 12:28:51 +00:00
|
|
|
before => File[$config_path],
|
2015-12-04 11:30:30 +00:00
|
|
|
notify => Class['Fluentd::Service'],
|
2015-12-01 12:28:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
file { $config_path:
|
|
|
|
ensure => $ensure,
|
|
|
|
content => $content,
|
|
|
|
owner => 'td-agent',
|
|
|
|
group => 'td-agent',
|
|
|
|
mode => '0644',
|
2015-12-04 11:30:30 +00:00
|
|
|
notify => Class['Fluentd::Service'],
|
2015-12-01 12:28:51 +00:00
|
|
|
}
|
|
|
|
}
|