diff --git a/manifests/common/headers.pp b/manifests/common/headers.pp index d7d74ca..7c304e1 100644 --- a/manifests/common/headers.pp +++ b/manifests/common/headers.pp @@ -10,33 +10,33 @@ $logging = hiera('beats::logging', undef), ) { concat { "/etc/${title}/${title}.yml": - group => 'root', - mode => '0755', - owner => 'root', - order => 'numeric', - require => Package[$title], + group => 'root', + mode => '0755', + owner => 'root', + order => 'numeric', + require => Package[$title], show_diff => false, } concat::fragment {"${title}-common-shipper-config": target => "/etc/${title}/${title}.yml", content => template('beats/shipper.erb'), - order => 01, + order => '01', } if $uid and $gid { concat::fragment {"${title}-common-runopts": target => "/etc/${title}/${title}.yml", content => template('beats/runopts.erb'), - order => 02, + order => '02', } } concat::fragment {"${title}-common-output-header": target => "/etc/${title}/${title}.yml", content => template('beats/outputs/output.header.erb'), - order => 20 + order => '20', } concat::fragment {"${title}-common-logging": target => "/etc/${title}/${title}.yml", content => template('beats/logging.erb'), - order => 100 + order => '100', } } diff --git a/manifests/filebeat.pp b/manifests/filebeat.pp index 886c753..e9bd2ae 100644 --- a/manifests/filebeat.pp +++ b/manifests/filebeat.pp @@ -6,14 +6,14 @@ $registry_file = '/var/lib/filebeat/registry', $spool_size = 1024, ){ - include beats::filebeat::config + include ::beats::filebeat::config case $::osfamily { 'Debian': { include ::apt::update package {'filebeat': ensure => $ensure, - require => Class['apt::update'] + require => Class['apt::update'], } } 'RedHat': { diff --git a/manifests/filebeat/config.pp b/manifests/filebeat/config.pp index 6269f68..7749399 100644 --- a/manifests/filebeat/config.pp +++ b/manifests/filebeat/config.pp @@ -4,7 +4,7 @@ concat::fragment {'filebeat.header': target => '/etc/filebeat/filebeat.yml', content => template('beats/filebeat/filebeat.yml.erb'), - order => 05, + order => '05', } # We read them again to combine the variables defined at different levels $p2 = hiera_hash('beats::filebeat::prospectors', {}) diff --git a/manifests/filebeat/prospector.pp b/manifests/filebeat/prospector.pp index 178e765..b95f907 100644 --- a/manifests/filebeat/prospector.pp +++ b/manifests/filebeat/prospector.pp @@ -18,6 +18,7 @@ $doc_type = undef, $max_bytes = undef, $multiline = undef, + $exclude_lines = undef, ) { concat::fragment {"prospector-${title}": diff --git a/manifests/init.pp b/manifests/init.pp index 29060a1..68dcc10 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -57,11 +57,11 @@ if ($manage_repo == true) { case $::osfamily { 'RedHat': { - include beats::repo::yum, beats::package, beats::config + include ::beats::repo::yum, ::beats::package, ::beats::config Class['beats::repo::yum'] -> Class['beats::package'] -> Class['beats::config'] } 'Debian': { - include beats::repo::apt, beats::package, beats::config + include ::beats::repo::apt, ::beats::package, ::beats::config Class['beats::repo::apt'] -> Class['beats::package'] -> Class['beats::config'] } default: { fail("${::osfamily} not supported yet") } @@ -70,11 +70,11 @@ else { case $::osfamily { 'RedHat': { - include beats::package, beats::config + include ::beats::package, ::beats::config Class['beats::package'] -> Class['beats::config'] } 'Debian': { - include beats::package, beats::config + include ::beats::package, ::beats::config Class['beats::package'] -> Class['beats::config'] } default: { fail("${::osfamily} not supported yet") } diff --git a/manifests/metricbeat.pp b/manifests/metricbeat.pp index deb267f..2d9e27c 100644 --- a/manifests/metricbeat.pp +++ b/manifests/metricbeat.pp @@ -13,7 +13,7 @@ include ::apt::update package {'metricbeat': ensure => $ensure, - require => Class['apt::update'] + require => Class['apt::update'], } } 'RedHat': { @@ -24,7 +24,7 @@ default: { fail("${::osfamily} not supported yet") } } - include beats::metricbeat::config + include ::beats::metricbeat::config service { 'metricbeat': ensure => running, diff --git a/manifests/metricbeat/config.pp b/manifests/metricbeat/config.pp index 49c5885..593844d 100644 --- a/manifests/metricbeat/config.pp +++ b/manifests/metricbeat/config.pp @@ -4,6 +4,6 @@ concat::fragment {'metricbeat.header': target => '/etc/metricbeat/metricbeat.yml', content => template('beats/metricbeat/metricbeat.yml.erb'), - order => 06, + order => '06', } } diff --git a/manifests/outputs/elasticsearch.pp b/manifests/outputs/elasticsearch.pp index 9737416..a9f1fe2 100644 --- a/manifests/outputs/elasticsearch.pp +++ b/manifests/outputs/elasticsearch.pp @@ -13,6 +13,6 @@ concat::fragment {"${title}-output-elasticsearch": target => "/etc/${title}/${title}.yml", content => template('beats/outputs/elasticsearch.erb'), - order => 21 + order => 21, } } diff --git a/manifests/outputs/logstash.pp b/manifests/outputs/logstash.pp index 21af16d..2758e2a 100644 --- a/manifests/outputs/logstash.pp +++ b/manifests/outputs/logstash.pp @@ -10,6 +10,6 @@ concat::fragment {"${title}-output-logstash": target => "/etc/${title}/${title}.yml", content => template('beats/outputs/logstash.erb'), - order => 22 + order => 22, } } diff --git a/manifests/packetbeat.pp b/manifests/packetbeat.pp index 8ce344c..e71ae47 100644 --- a/manifests/packetbeat.pp +++ b/manifests/packetbeat.pp @@ -24,14 +24,14 @@ $pgsql_max_rows = undef, $pgsql_max_row_length = undef, ){ - include beats::packetbeat::config + include ::beats::packetbeat::config case $::osfamily { 'Debian': { include ::apt::update package {'packetbeat': ensure => $beats::packetbeat::ensure, - require => Class['apt::update'] + require => Class['apt::update'], } } 'RedHat': { @@ -46,9 +46,9 @@ service { 'packetbeat': ensure => 'stopped', enable => false, - } + } } - default: { + default: { service { 'packetbeat': ensure => running, enable => true, diff --git a/manifests/packetbeat/config.pp b/manifests/packetbeat/config.pp index 22f8f97..707494a 100644 --- a/manifests/packetbeat/config.pp +++ b/manifests/packetbeat/config.pp @@ -1,18 +1,18 @@ # Packetbeat config -class beats::packetbeat::config inherits beats::packetbeat { +class beats::packetbeat::config inherits ::beats::packetbeat { beats::common::headers {'packetbeat':} concat::fragment {'packetbeat.header': target => '/etc/packetbeat/packetbeat.yml', content => template('beats/packetbeat/packetbeat.yml.erb'), - order => 05, + order => '05', } concat::fragment {'protocols.header': target => '/etc/packetbeat/packetbeat.yml', content => template('beats/protocols.header.erb'), - order => 10, + order => '10', } - if $http_enabled { include beats::protocols::http } - if $mysql_enabled { include beats::protocols::mysql } - if $pgsql_enabled { include beats::protocols::pgsql } - if $redis_enabled { include beats::protocols::redis } -} \ No newline at end of file + if $::beats::packetbeat::http_enabled { include ::beats::protocols::http } + if $::beats::packetbeat::mysql_enabled { include ::beats::protocols::mysql } + if $::beats::packetbeat::pgsql_enabled { include ::beats::protocols::pgsql } + if $::beats::packetbeat::redis_enabled { include ::beats::protocols::redis } +} diff --git a/manifests/repo.pp b/manifests/repo.pp index 18dc81c..b726987 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -3,11 +3,11 @@ case $::osfamily { 'Debian': { - class { 'beats::repo::apt': } + class { '::beats::repo::apt': } } 'RedHat': { - class { 'beats::repo::yum': } + class { '::beats::repo::yum': } } default: { fail("${::osfamily} not supported yet") } diff --git a/manifests/repo/apt.pp b/manifests/repo/apt.pp index 24c7cc6..448c38c 100644 --- a/manifests/repo/apt.pp +++ b/manifests/repo/apt.pp @@ -7,20 +7,20 @@ repos => 'main', key => { id => '46095ACC8548582C1A2699A9D27D666CD88E42B4', - server => 'pgp.mit.edu' + server => 'pgp.mit.edu', }, include => { - 'deb' => true - } + 'deb' => true, + }, } exec {'apt-get update': command => 'apt-get -qq update', - path => '/usr/bin', - unless => ['/usr/bin/dpkg -l | /bin/grep apt-transport-https'] + path => '/usr/bin', + unless => ['/usr/bin/dpkg -l | /bin/grep apt-transport-https'], } package {'apt-transport-https': ensure => latest, before => Apt::Source['elastic-beats'], - require => Exec['apt-get update'] + require => Exec['apt-get update'], } -} \ No newline at end of file +} diff --git a/manifests/repo/yum.pp b/manifests/repo/yum.pp index 0fbe49e..38006fc 100644 --- a/manifests/repo/yum.pp +++ b/manifests/repo/yum.pp @@ -8,7 +8,7 @@ descr => 'ES beats repository', enabled => '1', gpgcheck => '1', - gpgkey => 'http://packages.elastic.co/GPG-KEY-elasticsearch' + gpgkey => 'http://packages.elastic.co/GPG-KEY-elasticsearch', } } diff --git a/manifests/service.pp b/manifests/service.pp index d439cbd..b6bcd24 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,6 +1,6 @@ # Beats service class class beats::service() { - if $beats::packetbeat { include beats::packetbeat::service } - if $beats::filebeat { include beats::filebeat::service } - if $beats::topbeat { include beats::topbeat::service } + if $beats::packetbeat { include ::beats::packetbeat::service } + if $beats::filebeat { include ::beats::filebeat::service } + if $beats::topbeat { include ::beats::topbeat::service } } diff --git a/manifests/topbeat.pp b/manifests/topbeat.pp index 8e67e94..e109891 100644 --- a/manifests/topbeat.pp +++ b/manifests/topbeat.pp @@ -7,13 +7,13 @@ $stats_proc = true, $stats_filesystem = true, ){ - + case $::osfamily { 'Debian': { include ::apt::update package {'topbeat': ensure => $ensure, - require => Class['apt::update'] + require => Class['apt::update'], } } 'RedHat': { @@ -24,8 +24,8 @@ default: { fail("${::osfamily} not supported yet") } } - include beats::topbeat::config - + include ::beats::topbeat::config + service { 'topbeat': ensure => running, enable => true, diff --git a/manifests/topbeat/config.pp b/manifests/topbeat/config.pp index 340fa84..a98f26a 100644 --- a/manifests/topbeat/config.pp +++ b/manifests/topbeat/config.pp @@ -4,6 +4,6 @@ concat::fragment {'topbeat.header': target => '/etc/topbeat/topbeat.yml', content => template('beats/topbeat/topbeat.yml.erb'), - order => 06, + order => '06', } -} \ No newline at end of file +} diff --git a/metadata.json b/metadata.json index 2b84844..eaf3627 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ } ], "issues_url": "https://github.com/poolski/puppet-beats/issues", - "license": "GPL v2", + "license": "GPL-2.0", "name": "poolski-beats", "operatingsystem_support": [ { diff --git a/templates/filebeat/prospector.yml.erb b/templates/filebeat/prospector.yml.erb index a053208..20fe177 100644 --- a/templates/filebeat/prospector.yml.erb +++ b/templates/filebeat/prospector.yml.erb @@ -5,20 +5,21 @@ fields:<% @fields.each do |key, value| %> <%= key -%>: <%= value %> <%- end -%> -<%- if @encoding -%> encoding: <%= @encoding %><% end -%> -<%- if @ignore_older -%> ignore_older: <%= @ignore_older %><% end -%> -<%- if @scan_frequency -%> scan_frequency: <%= @scan_frequency %><% end -%> -<%- if @harvester_buffer_size -%> harvester_buffer_size: <%= @harvester_buffer_size %><% end -%> -<%- if @tail_files -%> tail_files: <%= @tail_files %><% end -%> -<%- if @backoff -%> backoff: <%= @backoff %><% end -%> -<%- if @max_backoff -%> max_backoff: <%= @max_backoff %><% end -%> -<%- if @backoff_factor -%> backoff_factor: <%= @backoff_factor %><% end -%> -<%- if @partial_line_waiting -%> partial_line_waiting: <%= @partial_line_waiting %><% end -%> -<%- if @force_close_files -%> force_close_files: <%= @force_close_files %><% end -%> -<%- if @fields_under_root -%> fields_under_root: <%= @fields_under_root %><% end -%> -<%- if @doc_type -%> document_type: <%= @doc_type %><% end -%> -<%- if @input_type -%> input_type: <%= @input_type %><% end -%> -<%- if @max_bytes -%> max_bytes: <%= @max_bytes %><% end -%> +<%- if @encoding -%> encoding: <%= @encoding %><% end %> +<%- if @ignore_older -%> ignore_older: <%= @ignore_older %><% end %> +<%- if @scan_frequency -%> scan_frequency: <%= @scan_frequency %><% end %> +<%- if @harvester_buffer_size -%> harvester_buffer_size: <%= @harvester_buffer_size %><% end %> +<%- if @tail_files -%> tail_files: <%= @tail_files %><% end %> +<%- if @backoff -%> backoff: <%= @backoff %><% end %> +<%- if @max_backoff -%> max_backoff: <%= @max_backoff %><% end %> +<%- if @backoff_factor -%> backoff_factor: <%= @backoff_factor %><% end %> +<%- if @partial_line_waiting -%> partial_line_waiting: <%= @partial_line_waiting %><% end %> +<%- if @force_close_files -%> force_close_files: <%= @force_close_files %><% end %> +<%- if @fields_under_root -%> fields_under_root: <%= @fields_under_root %><% end %> +<%- if @doc_type -%> document_type: <%= @doc_type %><% end %> +<%- if @input_type -%> input_type: <%= @input_type %><% end %> +<%- if @max_bytes -%> max_bytes: <%= @max_bytes %><% end %> +<%- if @exclude_lines -%> exclude_lines: <%= @exclude_lines %><% end %> <%- if @multiline -%> multiline:<% @multiline.each do |key, value| %> <%= key -%>: <%= value -%><%- end -%> <% end -%> diff --git a/tests/init.pp b/tests/init.pp index 2f72263..927a38f 100644 --- a/tests/init.pp +++ b/tests/init.pp @@ -9,4 +9,4 @@ # Learn more about module testing here: # http://docs.puppetlabs.com/guides/tests_smoke.html # -include packetbeat +include ::packetbeat