1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-12-16 13:20:35 +00:00
puppet-fluentd/manifests/config/file.pp

37 lines
1003 B
ObjectPascal
Raw Normal View History

# 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,
) {
if $caller_module_name != $module_name {
fail("Use of private fluentd::config::file by ${caller_module_name}")
}
$base_name = "${title}.conf"
$config_name = "${priority}-${base_name}"
$config_path = "${::fluentd::conf_dir}/${config_name}"
# clean up to ensure priority changes take effect
exec { "apply priority change for ${base_name}":
path => '/bin:/usr/bin:/usr/local/bin',
2016-01-26 21:38:44 +00:00
cwd => $::fluentd::conf_dir,
command => "rm *-${base_name}",
onlyif => "ls *-${base_name} | grep -v ${config_name}",
before => File[$config_path],
2015-12-04 11:30:30 +00:00
notify => Class['Fluentd::Service'],
}
file { $config_path:
ensure => $ensure,
content => $content,
owner => $::fluentd::user_name,
group => $::fluentd::user_group,
mode => '0644',
2015-12-04 11:30:30 +00:00
notify => Class['Fluentd::Service'],
}
}