2015-11-30 11:23:28 +00:00
|
|
|
# Class: fluentd
|
|
|
|
# ===========================
|
|
|
|
#
|
2015-12-04 10:03:52 +00:00
|
|
|
# Installs and configures Fluentd.
|
2015-11-30 11:23:28 +00:00
|
|
|
#
|
|
|
|
# Parameters
|
|
|
|
# ----------
|
2016-01-22 17:50:04 +00:00
|
|
|
# [*repo_manage*]
|
2015-11-30 17:13:24 +00:00
|
|
|
# Include repository to install recent fluentd (td-agent) from
|
|
|
|
# Default: 'true'
|
2017-07-24 12:33:21 +00:00
|
|
|
# [*conf_dir_manage*]
|
|
|
|
# Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted
|
|
|
|
# Default: 'false'
|
2015-11-30 17:13:24 +00:00
|
|
|
# [*package_ensure*]
|
|
|
|
# Package ensure
|
|
|
|
# Default: 'installed'
|
|
|
|
# [*package_name*]
|
|
|
|
# Package name
|
|
|
|
# Default: 'td-agent'
|
|
|
|
# [*package_install_options*]
|
|
|
|
# Package install options
|
|
|
|
# Default: '[]'
|
|
|
|
# [*service_manage*]
|
|
|
|
# Defines if the service should be managed by puppet
|
|
|
|
# Default: 'true'
|
|
|
|
# [*service_name*]
|
|
|
|
# Name of the service
|
|
|
|
# Default: 'td-agent'
|
|
|
|
# [*service_ensure*]
|
|
|
|
# Service ensure
|
|
|
|
# Default: 'running'
|
2016-07-13 19:55:55 +00:00
|
|
|
# [*service_enable*]
|
2015-12-22 12:56:46 +00:00
|
|
|
# Defines if the service should be enabled
|
|
|
|
# Default: 'true'
|
|
|
|
# [*user_manage*]
|
|
|
|
# Defines if the user should be manage, which will add the user
|
|
|
|
# to groups defined in $user_groups.
|
|
|
|
# For example to be able to view the /var/log directory with group adm
|
|
|
|
# Default: 'true'
|
|
|
|
# [*user_name*]
|
|
|
|
# Default: 'td-agent'
|
|
|
|
# [*user_group*]
|
|
|
|
# Default: 'td-agent'
|
|
|
|
# [*user_groups*]
|
|
|
|
# Default: '["adm"]'
|
2015-11-30 11:23:28 +00:00
|
|
|
#
|
|
|
|
# Examples
|
|
|
|
# --------
|
|
|
|
#
|
|
|
|
# @example
|
2015-11-30 17:13:24 +00:00
|
|
|
# include '::fluentd'
|
2015-11-30 11:23:28 +00:00
|
|
|
#
|
|
|
|
# Copyright
|
|
|
|
# ---------
|
|
|
|
#
|
2015-11-30 17:13:24 +00:00
|
|
|
# Copyright 2015 wywy GmbH, unless otherwise noted.
|
2015-11-30 11:23:28 +00:00
|
|
|
#
|
2015-11-30 14:18:26 +00:00
|
|
|
class fluentd (
|
2016-01-22 17:50:04 +00:00
|
|
|
$repo_manage = $::fluentd::params::repo_manage,
|
2015-11-30 16:04:14 +00:00
|
|
|
$package_ensure = $::fluentd::params::package_ensure,
|
|
|
|
$package_name = $::fluentd::params::package_name,
|
|
|
|
$package_install_options = $::fluentd::params::package_install_options,
|
2015-11-30 16:49:18 +00:00
|
|
|
$service_manage = $::fluentd::params::service_manage,
|
|
|
|
$service_name = $::fluentd::params::service_name,
|
|
|
|
$service_ensure = $::fluentd::params::service_ensure,
|
|
|
|
$service_enable = $::fluentd::params::service_enable,
|
2015-12-04 13:20:11 +00:00
|
|
|
$config_path = $::fluentd::params::config_path,
|
|
|
|
$conf_dir = $::fluentd::params::conf_dir,
|
2017-07-24 12:33:21 +00:00
|
|
|
$conf_dir_manage = $::fluentd::params::conf_dir_manage,
|
2015-12-04 13:20:11 +00:00
|
|
|
$config_file = $::fluentd::params::config_file,
|
2015-12-22 12:56:46 +00:00
|
|
|
$user_manage = $::fluentd::params::user_manage,
|
2015-12-04 13:20:11 +00:00
|
|
|
$user_name = $::fluentd::params::user_name,
|
|
|
|
$user_group = $::fluentd::params::user_group,
|
2015-12-22 12:56:46 +00:00
|
|
|
$user_groups = $::fluentd::params::user_groups,
|
2015-11-30 14:18:26 +00:00
|
|
|
) inherits fluentd::params {
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-11-30 16:49:18 +00:00
|
|
|
# parameter validation
|
2016-01-22 17:50:04 +00:00
|
|
|
validate_bool($repo_manage)
|
2015-11-30 16:04:14 +00:00
|
|
|
validate_string($package_ensure)
|
|
|
|
validate_string($package_name)
|
|
|
|
validate_array($package_install_options)
|
2015-11-30 16:49:18 +00:00
|
|
|
validate_bool($service_manage)
|
|
|
|
validate_string($service_name)
|
|
|
|
validate_bool($service_enable)
|
2015-12-09 15:04:28 +00:00
|
|
|
|
2015-11-30 16:49:18 +00:00
|
|
|
if ! ($service_ensure in [ 'running', 'stopped' ]) {
|
|
|
|
fail('service_ensure parameter must be running or stopped')
|
|
|
|
}
|
2015-11-30 14:18:26 +00:00
|
|
|
|
2015-12-03 18:28:11 +00:00
|
|
|
# class calls
|
|
|
|
include '::fluentd::repo'
|
|
|
|
include '::fluentd::install'
|
2015-12-22 12:56:46 +00:00
|
|
|
include '::fluentd::user'
|
2015-12-03 18:28:11 +00:00
|
|
|
include '::fluentd::config'
|
|
|
|
include '::fluentd::service'
|
|
|
|
|
|
|
|
# dependencies
|
2017-07-11 08:53:03 +00:00
|
|
|
Class['::Fluentd::Repo']
|
|
|
|
-> Class['::Fluentd::Install']
|
|
|
|
-> Class['::Fluentd::User']
|
|
|
|
-> Class['::Fluentd::Config']
|
|
|
|
-> Class['::Fluentd::Service']
|
2015-11-30 11:23:28 +00:00
|
|
|
}
|