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
|
|
|
|
# ---------
|
|
|
|
#
|
2017-08-10 12:24:22 +00:00
|
|
|
# Copyright 2015 wywy, unless otherwise noted.
|
2015-12-03 10:59:51 +00:00
|
|
|
#
|
|
|
|
define fluentd::plugin (
|
2018-01-16 15:22:13 +00:00
|
|
|
String $ensure = present,
|
|
|
|
String $type = 'gem',
|
|
|
|
Optional[String] $source = undef,
|
2015-12-03 10:59:51 +00:00
|
|
|
) {
|
|
|
|
|
|
|
|
case $type {
|
|
|
|
'gem': {
|
|
|
|
fluentd::plugin::gem { $name:
|
2015-12-07 10:09:31 +00:00
|
|
|
ensure => $ensure,
|
2015-12-09 15:04:28 +00:00
|
|
|
require => Class['Fluentd::Install'],
|
2015-12-03 10:59:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
'file': {
|
2016-05-11 16:32:31 +00:00
|
|
|
# parameter validation
|
|
|
|
if ! ($ensure in [ 'present', 'absent' ]) {
|
|
|
|
fail('ensure parameter must be present or absent')
|
|
|
|
}
|
2015-12-03 10:59:51 +00:00
|
|
|
|
|
|
|
fluentd::plugin::file { $name:
|
2015-12-07 10:09:31 +00:00
|
|
|
ensure => $ensure,
|
|
|
|
source => $source,
|
2015-12-09 15:04:28 +00:00
|
|
|
require => Class['Fluentd::Install'],
|
2015-12-03 10:59:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
fail("plugin type: '${type}' is currently not supported, use gem or file")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|