1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2025-09-13 00:49:29 +00:00

64 Commits
0.5.0 ... 1.0.0

Author SHA1 Message Date
Christian Becker
3c537f0ff5 bump version in changelog 2018-01-17 12:13:37 +01:00
Christian Becker
1077f6d5dd drop puppet 3 support from the tests 2018-01-17 12:05:05 +01:00
Christian Becker
90a16243a6 whoops i broke the tests 2018-01-17 11:22:32 +01:00
Christian Becker
dec8216a78 bump versions
- breaking change, so we bump the major version
- update dependency versions to keep them relatively fresh
- update repo urls
2018-01-17 11:04:19 +01:00
Christian Becker
948431f50c Merge pull request #23 from tinkerborg/master
Fix hard coded user/group names in config manifest
2018-01-16 18:46:05 +01:00
Christian Becker
d1d22c8874 Update Gemfile
bump nokogiri to remove github vulnerability message
2018-01-16 18:39:21 +01:00
Christian Becker
0023cc7902 Merge pull request #24 from wycore/puppet4
migrate from stdlib validation to puppet datatypes
2018-01-16 18:36:46 +01:00
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
tinkerborg
344453c241 Fix hard coded user/group names in config manifest 2018-01-12 15:27:53 -05:00
Max Wilhelm
71352ea6b1 prepare 0.6.0 2017-08-17 17:11:06 +02:00
Max Wilhelm
d7ab62a388 fixed licensing 2017-08-17 17:10:15 +02:00
Max Wilhelm
78f9c03952 Merge pull request #20 from wywy/rename_company
Rename company
2017-08-17 16:52:38 +02:00
Max Wilhelm
ca55558b44 some more renaming 2017-08-17 16:52:10 +02:00
Jan Krause
cd9813f574 rename company 2017-08-17 16:49:04 +02:00
Max Wilhelm
d6231c3b13 Merge pull request #19 from wywy/use_rspec_puppet_facts
Use rspec puppet facts
2017-08-17 14:08:11 +02:00
Max Wilhelm
fc0f3fdf88 use rspec-puppet-facts for source_spec 2017-08-17 13:34:13 +02:00
Max Wilhelm
613a28ccaf use rspec-puppet-facts for plugin_spec 2017-08-17 13:34:03 +02:00
Max Wilhelm
5f213da8b3 use rspec-puppet-facts for match_spec 2017-08-17 13:33:54 +02:00
Max Wilhelm
258a37ff11 use rspec-puppet-facts for filter_spec 2017-08-17 13:33:43 +02:00
Max Wilhelm
c2f95f4bc9 use rspec-puppet-facts for fluentd_user_spec 2017-08-17 13:26:38 +02:00
Max Wilhelm
257880811c use rspec-puppet-facts for fluentd_spec 2017-08-17 13:26:16 +02:00
Max Wilhelm
6e97016aac use rspec-puppet-facts for fluentd_service_spec 2017-08-17 13:26:03 +02:00
Max Wilhelm
b34c7dc4e4 use rspec-puppet-facts for fluentd_repo_yum_spec 2017-08-14 17:56:33 +02:00
Max Wilhelm
d7f6d91a11 use rspec-puppet-facts for fluentd_repo_apt_spec 2017-08-14 17:56:20 +02:00
Max Wilhelm
e8cdc9a9e0 use rspec-puppet-facts for fluentd_install_spec 2017-08-14 17:56:06 +02:00
Max Wilhelm
b51a559684 use rspec-puppet-facts for fluentd_config_spec 2017-08-14 17:55:39 +02:00
Max Wilhelm
754cd4a696 use rspec-puppet-facts for fluentd_repo_spec 2017-08-14 17:55:27 +02:00
Max Wilhelm
41a617c156 add and init rspec-puppet-facts 2017-08-14 17:54:56 +02:00
Max Wilhelm
0c62c616f0 updated comments & README 2017-08-14 13:18:06 +02:00
Max Wilhelm
76d26e8216 changed puppet-lint config 2017-08-14 13:07:16 +02:00
Max Wilhelm
780df1edae Merge pull request #18 from wywygmbh/fix_indentation
Fix indentation
2017-08-04 17:03:05 +02:00
Max Wilhelm
3e3de2aed9 fixed source.erb template indentation 2017-08-04 11:16:51 +02:00
Max Wilhelm
5f84f04f0f fixed match.erb template indentation 2017-08-04 11:16:31 +02:00
Max Wilhelm
ad17694713 fixed filter.erb template indentation 2017-08-04 11:16:07 +02:00
Max Wilhelm
f4da637999 Merge pull request #17 from wywygmbh/conf_file_fixtures
Conf file fixtures
2017-08-04 10:51:32 +02:00
Max Wilhelm
533857e49c added missing fixtures 2017-08-03 12:11:13 +02:00
Max Wilhelm
525fc9c5ab use fixtures for conf file tests
should help to solve https://github.com/wywygmbh/puppet-fluentd/issues/4
2017-08-03 12:00:59 +02:00
Max Wilhelm
bfa6de193e prepare 0.5.6 2017-07-25 16:24:03 +02:00
Max Wilhelm
5f3aca9597 Merge pull request #16 from lzecca78/master
bug in referenced class variable
2017-07-25 16:20:37 +02:00
Luca Zecca
ee3a8e968a bug in referenced class variable 2017-07-25 16:10:06 +02:00
Max Wilhelm
3f26736084 prepare 0.5.5 2017-07-25 15:17:22 +02:00
Max Wilhelm
d27479eb17 Merge pull request #15 from lzecca78/master
added boolean param for enabling fluentd::conf_dir
2017-07-25 15:13:28 +02:00
Luca Zecca
c8046ee2c6 added boolean param for enabling fluentd::conf_dir exclusive file handling by puppet. 2017-07-24 14:33:21 +02:00
Max Wilhelm
fc94e7ba6f prepare 0.5.4 2017-07-11 11:25:10 +02:00
Nicanor Gutierrez
3fb5293880 Fix formatting 2017-07-11 11:13:23 +02:00
Nicanor Gutierrez
e5650f47d1 Add path to exec to avoid error
Error received before: Error: Failed to apply catalog: Parameter onlyif failed on Exec[remove old GPG key]: 'rpm -qi gpg-pubkey-a12e206f-*' is not qualified and no path was specified. Please qualify the command or specify a path. at /etc/puppetlabs/code/environments/acceptance/modules/fluentd/manifests/repo/yum.pp:27
2017-07-11 11:13:23 +02:00
sgudmand
49848b2afd Change variable names for inner loop in filter.erb
When using the module with puppet 3.8.7, ran into an issue where the variable assignment of the inner loop was overwriting the variables of the same name in the outer loop.  This was causing filter configs to be generated with an unmatched record tag.  I have simply changed the names of the variables in the inner loop of the template so that the will no longer occur.
2017-07-11 11:13:11 +02:00
Max Wilhelm
f4c24ee881 fixed lint warnings 2017-07-11 10:53:53 +02:00
Max Wilhelm
2e789170a0 puppet lint configuration 2017-07-11 10:53:53 +02:00
Max Wilhelm
22a9578a88 drop support for ruby 1.9.3
EOL since February 23, 2015
2017-07-11 10:53:53 +02:00
Christian Becker
9eb19b3d1b prepare 0.5.3 2017-01-19 14:50:13 +01:00
Christian Becker
6a05cae33e Merge pull request #10 from lobeck/master
update tresuredata GPG key
2017-01-19 14:47:47 +01:00
Christian Becker
2183f670f2 change tresuredata GPG key
http://www.fluentd.org/blog/update-gpg-key-for-td-agent
2017-01-19 14:40:44 +01:00
Christian Becker
bcad5ca42c Merge pull request #11 from lobeck/gem_fix
fix public_suffix gem for ruby < 2.0
2017-01-19 14:25:40 +01:00
Christian Becker
26694848cb fix gems for ruby < 2.0
- pinned to older versions which are still compatible
- newer rubies will install the latest versions
2017-01-02 17:13:16 +01:00
Max Wilhelm
bb2346df50 prepare 0.5.2 release 2016-07-14 11:22:44 +02:00
Max Wilhelm
e062d4f2e0 disable_puppet_url_without_modules for puppet-lint 2016-07-14 11:12:20 +02:00
Max Wilhelm
f32ea2c0ba try to fix build 2016-07-14 10:56:34 +02:00
Max Wilhelm
8081e8df20 Merge pull request #9 from pdrakeweb/fix-parameter-docs
Correct the docs related to the service_enable parameter.
2016-07-14 10:55:58 +02:00
Peter Drake
6cb1364023 Correct the docs related to the service_enable parameter. 2016-07-13 15:55:55 -04:00
Max Wilhelm
3dab36ee83 prepare 0.5.1 release 2016-05-13 10:18:52 +02:00
Max Wilhelm
8916d18654 Merge pull request #8 from mhrabovcin/master
Allow to install specific version of fluent plugins
2016-05-13 10:16:40 +02:00
Martin Hrabovcin
75a537432c Fix tests for Puppet 4 2016-05-12 22:31:52 +02:00
Martin Hrabovcin
9754e64490 Allow to install specific version of fluent plugins 2016-05-11 18:32:31 +02:00
38 changed files with 632 additions and 581 deletions

View File

@@ -6,12 +6,14 @@ script: bundle exec rake validate && bundle exec rake lint && bundle exec rake s
matrix:
fast_finish: true
include:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.6
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
- rvm: 2.1.10
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes"
- rvm: 2.2.7
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes"
- rvm: 2.3.4
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes"
- rvm: 2.4.1
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes"
notifications:
slack:
secure: WVBx/OJqLpX9WXyiejEdnOcAf+5ShWJ2gcyeBCX032iKzPphcdPKqH+jnlFaKjqQCZARbRqzlj/if3FZWAlhWtTrWrcY545dRHcsaGvJ/nMtdHlBUuwUNHipSn+RTXtorsYz0efhJMPye2LMl0HgAp3rEs70XUt8rZOwdedLGVgfWRwM+KixhSf8P08v9QjNRNdhWII37KFRdqv/NHryNlVKsTLH6fQOyIvok3vrTvMR8rWMRETXv6JLpCJ3FfOrxo53fW7q+GlXXuVcQ2OGlgxm3eke6q2aXZAqczeB5CSlWgUEA5T3rQ//WI3enwTayRajV/9O26HZvASjSTnDRiSSv1itYqg1Uy6kuJy5ANpBizOyWY6/QTM5Rw00AXvaY9ur0EmyNe5vLNHyTxzdr4R+rXjE07yCDvWM9RGbu+4BipP+mAoJTkuCIP54FWYn1qOJnC8DYywD/+wniCNLbp6yMgbG/aC6H5RmuSy+3xRoEbwvyXKUgA+4gL3I3aAIvidBG+yazRBFvRCn4pUJdTEc4Cpu0jhQWXWyZSE66HNPKyIOXl9JPTzul08MDo9OaqBt+K3yeMVA8EPr196mWLwerF+dExQ2PJhUu/7MAiOgFrIr4/d05iKhj4ivLYBRNN317s2NVo8qyfhPHlfv6PyzhllC/qjClQ2rLOemVhg=

View File

@@ -1,5 +1,38 @@
# Changelog
## 1.0.0
**Breaking changes:** This version drops puppet 3 support!
* Fix hard coded user/group names in config manifest (#23)
* migrate from stdlib validation to puppet datatypes (#24)
## 0.6.0
* Updated README
* fixed broken links, due to github organisation rename
* fixed indentation for config files (filter, match, source)
* use rspec-puppet-facts for unit testing
## 0.5.6
* Fixed `conf_dir_manage` parameter call
## 0.5.5
* Added `conf_dir_manage` parameter (Default: false)
* Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted
## 0.5.4
* fixed templates/filter.erb
* fixed removing of old GPG key for yum repos
## 0.5.3
* update treasure data repo gpg key
## 0.5.2
* Correct the docs related to the service_enable parameter
## 0.5.1
* Allow to install specific version of fluent gem plugins
## 0.5.0
* Added support for Debian 6, 7, 8
* Added support for CentOS 6, 7

16
Gemfile
View File

@@ -1,10 +1,22 @@
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 3.3']
ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.6' : puppetversion = ENV['PUPPET_VERSION'].to_s
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.8.2'
gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0'
gem 'beaker-rspec'
gem 'beaker-puppet_install_helper'
gem 'metadata-json-lint'
gem 'rspec-puppet-facts', '~> 1.7'
beakerrspec = '> 0'
platforms [:ruby_19, :ruby_21] do
beakerrspec = '<= 5.6.0'
end
gem 'beaker-rspec', beakerrspec
platforms :ruby_19 do
gem 'public_suffix', '< 1.5.0', :platforms => :ruby_19
gem 'nokogiri', '~> 1.8.1', :platforms => :ruby_19
gem 'mime-types', '< 3.0', :platforms => :ruby_19
end

View File

@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015 wywy GmbH
Copyright 2017 ATVAG GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
# wywygmbh/fluentd Puppet Module
# wywy/fluentd Puppet Module
[![GitHub version](https://badge.fury.io/gh/wywygmbh%2Fpuppet-fluentd.svg)](https://github.com/wywygmbh/puppet-fluentd)
[![Build Status](https://travis-ci.org/wywygmbh/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywygmbh/puppet-fluentd)
[![GitHub version](https://badge.fury.io/gh/wywy%2Fpuppet-fluentd.svg)](https://github.com/wywy/puppet-fluentd)
[![Build Status](https://travis-ci.org/wywy/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywy/puppet-fluentd)
@@ -79,11 +79,31 @@ include '::fluentd'
Service ensure.
**Default:** 'running'
`service_enabled`
`service_enable`
Defines if the service should be enabled.
**Default:** 'true'
`config_path`
Path to configuration files
**Default:** '/etc/td-agent'
`config_dir`
Configuration directory name
**Default:** '${config_path}/conf.d'
`config_file`
Default configuration file name
**Default:** '${config_path}/td-agent.conf'
`conf_dir_manage`
Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted
**Default:** 'false'
`user_manage`
Defines if the user should be manage, which will add the user
@@ -228,7 +248,8 @@ This module gives you the possibility to install plugins as gem or files.
**gem installation**
```puppet
::fluentd::plugin { 'fluent-plugin-elasticsearch':
type => 'gem'
type => 'gem',
ensure => '0.1.3'
}
```
**file installation**
@@ -242,14 +263,14 @@ This module gives you the possibility to install plugins as gem or files.
### Requirements
Modules:
* puppetlabs/apt >= 1.8.0 < 3.0.0
* puppetlabs/apt >= 4.0.0
## Limitations
This module has been built on and tested against Puppet 3.7.5 and higher.
This module has been built on and tested against Puppet 4.6 and higher.
The module has been tested on:
* Ubuntu 12.04
* Ubuntu 16.04
Testing on other platforms has been light and cannot be guaranteed.
@@ -264,8 +285,8 @@ To run the tests install the ruby dependencies with `bundler` and execute
bundle install --path vendor/bundle
bundle exec rake spec
bundle exec rake lint
bundle exec rake beaker BEAKER_set=ubuntu-server-1204-x64
bundle exec rake beaker BEAKER_set=ubuntu-server-1404-x64
bundle exec rake beaker BEAKER_set=ubuntu-server-1604-x64
bundle exec rake beaker BEAKER_set=debian-60-x64
bundle exec rake beaker BEAKER_set=debian-78-x64
bundle exec rake beaker BEAKER_set=debian-82-x64
@@ -275,7 +296,7 @@ bundle exec rake beaker BEAKER_set=centos-70-x64
## License
Copyright 2015 wywy GmbH
Copyright 2017 ATVAG GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -289,4 +310,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This Puppet module is being actively maintained by some fellow puppeteers at [wywy GmbH](http://wywy.com/).
This Puppet module is being actively maintained by some fellow puppeteers at [wywy](http://wywy.com/).

View File

@@ -1,7 +1,23 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('relative')
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
exclude_paths = %w(
pkg/**/*
vendor/**/*
.vendor/**/*
spec/**/*
)
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths
desc "Validate manifests, templates, and ruby files"
task :validate do

View File

@@ -5,5 +5,5 @@
# file installation
::fluentd::plugin { 'fluent-plugin-elasticsearch':
type => 'file',
source => 'puppet:///path/to/plugin'
source => 'puppet:///modules/path/to/plugin'
}

View File

@@ -12,6 +12,8 @@ class fluentd::config inherits fluentd {
file { $::fluentd::conf_dir:
ensure => 'directory',
recurse => $::fluentd::conf_dir_manage,
purge => $::fluentd::conf_dir_manage,
owner => $::fluentd::user_name,
group => $::fluentd::user_group,
mode => '0750',

View File

@@ -28,8 +28,8 @@ define fluentd::config::file (
file { $config_path:
ensure => $ensure,
content => $content,
owner => 'td-agent',
group => 'td-agent',
owner => $::fluentd::user_name,
group => $::fluentd::user_group,
mode => '0644',
notify => Class['Fluentd::Service'],
}

View File

@@ -35,26 +35,19 @@
# Copyright
# ---------
#
# Copyright 2015 wywy GmbH, unless otherwise noted.
# Copyright 2015 wywy, unless otherwise noted.
#
define fluentd::filter (
$ensure = present,
$priority = 20,
$pattern = '**',
$config = {},
Enum['present', 'absent'] $ensure = present,
Integer $priority = 20,
String $pattern = '**',
Hash $config = {},
) {
# parameter validation
if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent')
}
validate_integer($priority)
validate_string($pattern)
validate_hash($config)
fluentd::config::file { "filter-${title}":
ensure => $ensure,
priority => $priority,
content => template( 'fluentd/filter.erb'),
}
}

View File

@@ -26,9 +26,21 @@
# [*service_ensure*]
# Service ensure
# Default: 'running'
# [*service_enabled*]
# [*service_enable*]
# Defines if the service should be enabled
# Default: 'true'
# [*config_path*]
# Path to configuration files
# Default: '/etc/td-agent'
# [*config_dir*]
# Configuration directory name
# Default: '${config_path}/conf.d'
# [*config_file*]
# Default configuration file name
# Default: '${config_path}/td-agent.conf'
# [*conf_dir_manage*]
# Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted
# Default: 'false'
# [*user_manage*]
# Defines if the user should be manage, which will add the user
# to groups defined in $user_groups.
@@ -50,39 +62,27 @@
# Copyright
# ---------
#
# Copyright 2015 wywy GmbH, unless otherwise noted.
# Copyright 2015 wywy, unless otherwise noted.
#
class fluentd (
$repo_manage = $::fluentd::params::repo_manage,
$package_ensure = $::fluentd::params::package_ensure,
$package_name = $::fluentd::params::package_name,
$package_install_options = $::fluentd::params::package_install_options,
$service_manage = $::fluentd::params::service_manage,
$service_name = $::fluentd::params::service_name,
$service_ensure = $::fluentd::params::service_ensure,
$service_enable = $::fluentd::params::service_enable,
$config_path = $::fluentd::params::config_path,
$conf_dir = $::fluentd::params::conf_dir,
$config_file = $::fluentd::params::config_file,
$user_manage = $::fluentd::params::user_manage,
$user_name = $::fluentd::params::user_name,
$user_group = $::fluentd::params::user_group,
$user_groups = $::fluentd::params::user_groups,
Boolean $repo_manage = $::fluentd::params::repo_manage,
String $package_ensure = $::fluentd::params::package_ensure,
String $package_name = $::fluentd::params::package_name,
Array $package_install_options = $::fluentd::params::package_install_options,
Boolean $service_manage = $::fluentd::params::service_manage,
String $service_name = $::fluentd::params::service_name,
Enum['running', 'stopped'] $service_ensure = $::fluentd::params::service_ensure,
Boolean $service_enable = $::fluentd::params::service_enable,
String $config_path = $::fluentd::params::config_path,
String $conf_dir = $::fluentd::params::conf_dir,
String $config_file = $::fluentd::params::config_file,
Boolean $conf_dir_manage = $::fluentd::params::conf_dir_manage,
Boolean $user_manage = $::fluentd::params::user_manage,
String $user_name = $::fluentd::params::user_name,
String $user_group = $::fluentd::params::user_group,
Array $user_groups = $::fluentd::params::user_groups,
) inherits fluentd::params {
# parameter validation
validate_bool($repo_manage)
validate_string($package_ensure)
validate_string($package_name)
validate_array($package_install_options)
validate_bool($service_manage)
validate_string($service_name)
validate_bool($service_enable)
if ! ($service_ensure in [ 'running', 'stopped' ]) {
fail('service_ensure parameter must be running or stopped')
}
# class calls
include '::fluentd::repo'
include '::fluentd::install'
@@ -91,9 +91,9 @@ class fluentd (
include '::fluentd::service'
# dependencies
Class['::Fluentd::Repo'] ->
Class['::Fluentd::Install'] ->
Class['::Fluentd::User'] ->
Class['::Fluentd::Config'] ->
Class['::Fluentd::Service']
Class['::Fluentd::Repo']
-> Class['::Fluentd::Install']
-> Class['::Fluentd::User']
-> Class['::Fluentd::Config']
-> Class['::Fluentd::Service']
}

View File

@@ -40,26 +40,19 @@
# Copyright
# ---------
#
# Copyright 2015 wywy GmbH, unless otherwise noted.
# Copyright 2015 wywy, unless otherwise noted.
#
define fluentd::match (
$ensure = present,
$priority = 30,
$pattern = '**',
$config = {},
Enum['present', 'absent'] $ensure = present,
Integer $priority = 30,
String $pattern = '**',
Hash $config = {},
) {
# parameter validation
if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent')
}
validate_integer($priority)
validate_string($pattern)
validate_hash($config)
fluentd::config::file { "match-${title}":
ensure => $ensure,
priority => $priority,
content => template( 'fluentd/match.erb'),
}
}

View File

@@ -11,6 +11,7 @@ class fluentd::params {
# config params
$config_path = '/etc/td-agent'
$conf_dir = "${config_path}/conf.d"
$conf_dir_manage = false
$config_file = "${config_path}/td-agent.conf"
# user params
$user_manage = true

View File

@@ -23,19 +23,14 @@
# Copyright
# ---------
#
# Copyright 2015 wywy GmbH, unless otherwise noted.
# Copyright 2015 wywy, unless otherwise noted.
#
define fluentd::plugin (
$ensure = present,
$type = 'gem',
$source = undef,
String $ensure = present,
String $type = 'gem',
Optional[String] $source = undef,
) {
# parameter validation
if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent')
}
case $type {
'gem': {
fluentd::plugin::gem { $name:
@@ -44,7 +39,10 @@ define fluentd::plugin (
}
}
'file': {
validate_string($source)
# parameter validation
if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent')
}
fluentd::plugin::file { $name:
ensure => $ensure,

View File

@@ -7,7 +7,7 @@ class fluentd::repo::apt (
$repos = 'contrib',
$architecture = $::architecture,
$key = {
'id' => 'C901622B5EC4AF820C38AB861093DB45A12E206F',
'id' => 'BEE682289B2217F45AF4CC3F901F9177AB97ACBE',
'source' => 'http://packages.treasuredata.com/GPG-KEY-td-agent'
},
$include = {

View File

@@ -23,4 +23,12 @@ class fluentd::repo::yum (
path => '/bin:/usr/bin/',
refreshonly => true,
}
exec { 'remove old GPG key':
command => 'rpm -e --allmatches gpg-pubkey-a12e206f-*',
path => '/bin:/usr/bin/',
onlyif => 'rpm -qi gpg-pubkey-a12e206f-*',
notify => Exec['add GPG key'],
}
}

View File

@@ -31,20 +31,18 @@
# Copyright
# ---------
#
# Copyright 2015 wywy GmbH, unless otherwise noted.
# Copyright 2015 wywy, unless otherwise noted.
#
define fluentd::source (
$ensure = present,
$priority = 10,
$config = {},
String $ensure = present,
Integer $priority = 10,
Hash $config = {},
) {
# parameter validation
if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent')
}
validate_integer($priority)
validate_hash($config)
fluentd::config::file { "source-${title}":
ensure => $ensure,

View File

@@ -1,17 +1,17 @@
{
"name": "wywygmbh-fluentd",
"version": "0.5.0",
"author": "wywy GmbH",
"name": "wycore-fluentd",
"version": "1.0.0",
"author": "wywy",
"summary": "Generic module for fluentd (td-agent).",
"license": "Apache-2.0",
"source": "https://github.com/wywygmbh/puppet-fluentd",
"project_page": "https://github.com/wywygmbh/puppet-fluentd",
"issues_url": "https://github.com/wywygmbh/puppet-fluentd/issues",
"source": "https://github.com/wycore/puppet-fluentd",
"project_page": "https://github.com/wycore/puppet-fluentd",
"issues_url": "https://github.com/wycore/puppet-fluentd/issues",
"tags": ["fluentd", "td-agent"],
"operatingsystem_support": [
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [ "14.04", "12.04" ]
"operatingsystemrelease": [ "16.04", "14.04" ]
},
{
"operatingsystem": "Debian",
@@ -24,7 +24,7 @@
],
"dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0 < 5.0.0" },
{ "name": "puppetlabs/apt", "version_requirement": ">= 2.0.0 < 3.0.0" }
{ "name": "puppetlabs/apt", "version_requirement": ">= 4.0.0" }
],
"data_provider": null
}

View File

@@ -1,7 +1,14 @@
require 'spec_helper'
describe 'fluentd::config', :type => :class do
shared_examples 'when called with no parameters' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' do
it {
should contain_file('/etc/td-agent/td-agent.conf').with({
'ensure' => 'file',
@@ -19,27 +26,6 @@ describe 'fluentd::config', :type => :class do
})
}
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end

View File

@@ -1,8 +1,13 @@
require 'spec_helper'
describe 'fluentd::install', :type => :class do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
shared_examples 'when called with no parameters' do
describe 'when called with no parameters' do
it {
should contain_package('fluentd').with({
'ensure' => 'installed',
@@ -11,27 +16,6 @@ describe 'fluentd::install', :type => :class do
})
}
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end

View File

@@ -1,27 +1,22 @@
require 'spec_helper'
describe 'fluentd::repo::apt', :type => :class do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters on Ubuntu' do
case facts[:osfamily]
when 'Debian'
it {
should contain_class('apt')
should contain_apt__source('treasure-data').with({
'ensure' => 'present',
'location' => 'http://packages.treasuredata.com/2/ubuntu/precise',
'release' => 'precise',
'repos' => 'contrib',
'architecture' => 'amd64',
'key' => {
'id' => 'C901622B5EC4AF820C38AB861093DB45A12E206F',
'id' => 'BEE682289B2217F45AF4CC3F901F9177AB97ACBE',
'source' => 'http://packages.treasuredata.com/GPG-KEY-td-agent'
},
'include' => {
@@ -30,5 +25,57 @@ describe 'fluentd::repo::apt', :type => :class do
}
})
}
case facts[:operatingsystem]
when 'Ubuntu'
case facts[:lsbdistcodename]
when 'precise'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/precise',
'release' => 'precise'
})
}
when 'trusty'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/trusty',
'release' => 'trusty'
})
}
when 'xenial'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/xenial',
'release' => 'xenial'
})
}
end
when 'Debian'
case facts[:lsbdistcodename]
when 'jessie'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/jessie',
'release' => 'jessie'
})
}
when 'squeeze'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/squeeze',
'release' => 'squeeze'
})
}
when 'wheezy'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/wheezy',
'release' => 'wheezy'
})
}
end
end
end
end
end
end

View File

@@ -1,29 +1,21 @@
require 'spec_helper'
describe 'fluentd::repo', :type => :class do
context 'when called with no parameters on osfamily Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
it {
should contain_class('fluentd::repo::apt')
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
context 'when called with no parameters on osfamily RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
it {
should contain_class('fluentd::repo::yum')
}
describe 'when called with no parameters' do
case facts[:osfamily]
when 'Debian'
it { is_expected.to contain_class('fluentd::repo::apt') }
when 'RedHat'
it { is_expected.to contain_class('fluentd::repo::yum') }
end
end
end
end
end

View File

@@ -1,13 +1,15 @@
require 'spec_helper'
describe 'fluentd::repo::yum', :type => :class do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters on RedHat' do
describe 'when called with no parameters' do
case facts[:osfamily]
when 'RedHat'
it {
should contain_yumrepo('treasure-data').with({
'ensure' => 'present',
@@ -24,4 +26,7 @@ describe 'fluentd::repo::yum', :type => :class do
})
}
end
end
end
end
end

View File

@@ -1,7 +1,13 @@
require 'spec_helper'
describe 'fluentd::config', :type => :class do
shared_examples 'when called with no parameters' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' do
it {
should contain_service('fluentd').with({
'name' => 'td-agent',
@@ -12,27 +18,6 @@ describe 'fluentd::config', :type => :class do
})
}
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end

View File

@@ -1,7 +1,13 @@
require 'spec_helper'
describe 'fluentd', :type => :class do
shared_examples 'when called with no parameters' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' do
it {
should contain_class('fluentd::repo')
should contain_class('fluentd::install')
@@ -9,28 +15,6 @@ describe 'fluentd', :type => :class do
should contain_class('fluentd::service')
}
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end

View File

@@ -1,7 +1,13 @@
require 'spec_helper'
describe 'fluentd::user', :type => :class do
shared_examples 'when called with no parameters' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' do
it {
should contain_user('fluentd').with({
'name' => 'td-agent',
@@ -10,27 +16,6 @@ describe 'fluentd::user', :type => :class do
})
}
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end

View File

@@ -1,21 +1,19 @@
require 'spec_helper'
describe 'fluentd::filter' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let(:pre_condition) { 'include fluentd' }
context 'basic filter' do
describe 'basic filter' do
let(:title) { 'test' }
let(:params) do
{
priority: '20',
priority: 20,
pattern: '*.test',
config: {
'type' => 'record_transformer',
@@ -28,12 +26,9 @@ describe 'fluentd::filter' do
it do
is_expected.to contain_file('/etc/td-agent/conf.d/20-filter-test.conf').
with_content(/<filter \*.test>/).
with_content(/type record_transformer/).
with_content(/<record>/).
with_content(/hostname \$\{hostname\}/).
with_content(/<\/record>/).
with_content(/<\/filter>/)
with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/filter_record_transformer.conf')))
end
end
end
end
end

View File

@@ -1,21 +1,19 @@
require 'spec_helper'
describe 'fluentd::match' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let(:pre_condition) { 'include fluentd' }
context 'basic match' do
describe 'basic match' do
let(:title) { 'test' }
let(:params) do
{
priority: '30',
priority: 30,
pattern: '*.test',
config: {
'flush_interval' => '30s',
@@ -35,25 +33,15 @@ describe 'fluentd::match' do
it do
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
with_content(/<match \*.test>/).
with_content(/flush_interval 30s/).
with_content(/type secure_forward/).
with_content(/secure yes/).
with_content(/shared_key my_shared_key/).
with_content(/self_hostname instance.test.com/).
with_content(/ca_cert_path \/path\/to\/ca.cert/).
with_content(/<server>/).
with_content(/host test.server.com/).
with_content(/<\/server>/).
with_content(/<\/match>/)
with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_secure_forward.conf')))
end
end
context 'multiple store' do
describe 'multiple store' do
let(:title) { 'test' }
let(:params) do
{
priority: '30',
priority: 30,
pattern: '*.test',
config: {
'type' => 'copy',
@@ -75,19 +63,9 @@ describe 'fluentd::match' do
it do
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
with_content(/<match \*.test>/).
with_content(/type copy/).
with_content(/<store>/).
with_content(/type elasticsearch/).
with_content(/logstashformat true/).
with_content(/hosts 172.20.10.17:9200/).
with_content(/flush_interval 30s/).
with_content(/<\/store>/).
with_content(/<store>/).
with_content(/type file/).
with_content(/path \/tmp\/td-agent-debug.log/).
with_content(/<\/store>/).
with_content(/<\/match>/)
with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_copy.conf')))
end
end
end
end
end

View File

@@ -1,17 +1,15 @@
require 'spec_helper'
describe 'fluentd::plugin' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let(:pre_condition) { 'include fluentd' }
context 'gem plugin' do
describe 'gem plugin' do
let(:title) { 'fluent-plugin-elasticsearch' }
let(:params) do
{
@@ -28,7 +26,7 @@ describe 'fluentd::plugin' do
end
end
context 'file plugin' do
describe 'file plugin' do
let(:title) { 'fluent-plugin-test' }
let(:params) do
{
@@ -48,4 +46,6 @@ describe 'fluentd::plugin' do
})
end
end
end
end
end

View File

@@ -1,21 +1,19 @@
require 'spec_helper'
describe 'fluentd::source' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let(:pre_condition) { 'include fluentd' }
context 'basic source' do
describe 'basic source' do
let(:title) { 'test' }
let(:params) do
{
priority: '10',
priority: 10,
config: {
'type' => 'tail',
'format' => 'json',
@@ -27,12 +25,9 @@ describe 'fluentd::source' do
it do
is_expected.to contain_file('/etc/td-agent/conf.d/10-source-test.conf').
with_content(/<source>/).
with_content(/type tail/).
with_content(/format json/).
with_content(/path \/var\/log\/test-application\/\*.json/).
with_content(/tag application.test/).
with_content(/<\/source>/)
with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/source_tail.conf')))
end
end
end
end
end

View File

@@ -0,0 +1,6 @@
<filter *.test>
type record_transformer
<record>
hostname ${hostname}
</record>
</filter>

13
spec/fixtures/files/match_copy.conf vendored Normal file
View File

@@ -0,0 +1,13 @@
<match *.test>
type copy
<store>
type elasticsearch
logstashformat true
hosts 172.20.10.17:9200
flush_interval 30s
</store>
<store>
type file
path /tmp/td-agent-debug.log
</store>
</match>

View File

@@ -0,0 +1,11 @@
<match *.test>
flush_interval 30s
type secure_forward
secure yes
shared_key my_shared_key
self_hostname instance.test.com
ca_cert_path /path/to/ca.cert
<server>
host test.server.com
</server>
</match>

6
spec/fixtures/files/source_tail.conf vendored Normal file
View File

@@ -0,0 +1,6 @@
<source>
type tail
format json
path /var/log/test-application/*.json
tag application.test
</source>

View File

@@ -1 +1,3 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts

View File

@@ -2,8 +2,8 @@
<% @config.each do |key, val| -%>
<%- if val.is_a?( Hash ) -%>
<<%= key -%>>
<%- val.each do |key, val| -%>
<%= key -%> <%= val %>
<%- val.each do |key2, val2| -%>
<%= key2 -%> <%= val2 %>
<%- end -%>
</<%= key %>>
<%- else -%>