mirror of
https://github.com/krislamo/puppet-fluentd
synced 2025-09-07 23:09:30 +00:00
added definition to install plugins
This commit is contained in:
33
manifests/plugin.pp
Normal file
33
manifests/plugin.pp
Normal file
@@ -0,0 +1,33 @@
|
||||
# Install fluentd plugins
|
||||
#
|
||||
define fluentd::plugin (
|
||||
$ensure = present,
|
||||
$type = 'gem',
|
||||
$source = undef,
|
||||
) {
|
||||
|
||||
# parameter validation
|
||||
if ! ($ensure in [ 'present', 'absent' ]) {
|
||||
fail('ensure parameter must be present or absent')
|
||||
}
|
||||
|
||||
case $type {
|
||||
'gem': {
|
||||
fluentd::plugin::gem { $name:
|
||||
ensure => $ensure,
|
||||
require => Class['Fluentd::Install']
|
||||
}
|
||||
}
|
||||
'file': {
|
||||
validate_string($source)
|
||||
|
||||
fluentd::plugin::file { $name:
|
||||
ensure => $ensure,
|
||||
require => Class['Fluentd::Install']
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("plugin type: '${type}' is currently not supported, use gem or file")
|
||||
}
|
||||
}
|
||||
}
|
20
manifests/plugin/file.pp
Normal file
20
manifests/plugin/file.pp
Normal file
@@ -0,0 +1,20 @@
|
||||
# Install fluentd file plugins
|
||||
#
|
||||
define fluentd::plugin::file (
|
||||
$ensure = present,
|
||||
$source = undef,
|
||||
) {
|
||||
|
||||
if $caller_module_name != $module_name {
|
||||
fail("Use of private fluentd::plugin::file by ${caller_module_name}")
|
||||
}
|
||||
|
||||
file { "/etc/td-agent/plugin/${name}":
|
||||
ensure => $ensure,
|
||||
owner => 'td-agent',
|
||||
group => 'td-agent',
|
||||
mode => '0640',
|
||||
source => $source,
|
||||
notify => Class['Fluentd::Service'];
|
||||
}
|
||||
}
|
16
manifests/plugin/gem.pp
Normal file
16
manifests/plugin/gem.pp
Normal file
@@ -0,0 +1,16 @@
|
||||
# Install fluentd gem plugins
|
||||
#
|
||||
define fluentd::plugin::gem (
|
||||
$ensure = present,
|
||||
) {
|
||||
|
||||
if $caller_module_name != $module_name {
|
||||
fail("Use of private fluentd::plugin::gem by ${caller_module_name}")
|
||||
}
|
||||
|
||||
package { $name:
|
||||
ensure => $ensure,
|
||||
provider => 'fluentd_gem',
|
||||
notify => Class['Fluentd::Service'];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user