2015-12-04 10:03:52 +00:00
|
|
|
# Define: fluentd::plugin
|
|
|
|
# ===========================
|
|
|
|
#
|
|
|
|
# Installs a plugin for fluentd.
|
|
|
|
#
|
|
|
|
# Parameters
|
|
|
|
# ----------
|
|
|
|
# [*ensure*]
|
|
|
|
# Default: 'present'
|
|
|
|
# [*type*]
|
|
|
|
# Which type of plugin, allowed values are gem and file
|
|
|
|
# Default: 'gem'
|
|
|
|
# [*source*]
|
|
|
|
# source to file for the plugin only needed if you use type: file
|
|
|
|
# Default: 'undef'
|
|
|
|
#
|
|
|
|
# Examples
|
|
|
|
# --------
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# ::fluentd::plugin { 'fluent-plugin-elasticsearch': }
|
|
|
|
#
|
|
|
|
# Copyright
|
|
|
|
# ---------
|
|
|
|
#
|
|
|
|
# Copyright 2015 wywy GmbH, unless otherwise noted.
|
2015-12-03 10:59:51 +00:00
|
|
|
#
|
|
|
|
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,
|
2015-12-04 12:27:29 +00:00
|
|
|
source => $source,
|
2015-12-03 10:59:51 +00:00
|
|
|
require => Class['Fluentd::Install']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
fail("plugin type: '${type}' is currently not supported, use gem or file")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|