1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-09-19 20:20:35 +00:00
puppet-fluentd/manifests/source.pp
Christian Becker 9eea9f2009 migrate from stdlib validation to puppet datatypes
fixes some puppet 4 deprecation warnings caused by stdlib
2018-01-16 16:23:03 +01:00

53 lines
1.0 KiB
Puppet

# Define: fluentd::source
# ===========================
#
# Configures a 'source' config file.
#
# Parameters
# ----------
# [*ensure*]
# Default: 'present'
# [*priority*]
# Defines the priority
# Default: '10'
# [*config*]
# Configuration, which must be a hash
# Default: {}'
#
# Examples
# --------
#
# @example
# ::fluentd::source { 'test':
# priority => 10,
# config => {
# 'type' => 'tail',
# 'format' => 'json',
# 'path' => '/var/log/test-application/*.json',
# 'tag' => 'application.test'
# }
# }
#
# Copyright
# ---------
#
# Copyright 2015 wywy, unless otherwise noted.
#
define fluentd::source (
String $ensure = present,
Integer $priority = 10,
Hash $config = {},
) {
# parameter validation
if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent')
}
fluentd::config::file { "source-${title}":
ensure => $ensure,
priority => $priority,
content => template( 'fluentd/source.erb'),
}
}