diff --git a/README.md b/README.md index d953b17..363cee5 100644 --- a/README.md +++ b/README.md @@ -198,14 +198,6 @@ Installs and configures packetbeat. to the node's package manager. (default: true) - `package_ensure`: [String] The desired state of the Package resources. Only applicable if `ensure` is 'present'. (default: 'present') -- `path_conf`: [Stdlib::Absolutepath] The base path for all packetbeat - configurations. (default: /etc/packetbeat) -- `path_data`: [Stdlib::Absolutepath] The base path to where packetbeat stores - its data. (default: /var/lib/packetbeat) -- `path_home`: [Stdlib::Absolutepath] The base path for the packetbeat installation, - where the packetbeat binary is stored. (default: /usr/share/packetbeat) -- `path_logs`: [Stdlib::Absolutepath] The base path for packetbeat's log files. - (default: /var/log/packetbeat) - `processors`: [Array[Hash]] Add processors to the configuration to run on data before sending to the output. (default: undef) - `queue`: [Hash] Configure the internal queue in packetbeat before being consumed @@ -231,7 +223,7 @@ Installs and configures packetbeat. #### Class: `packetbeat::config` -Manages packetbeats main configuration file under `path_conf` +Manages packetbeats main configuration file. #### Class: `packetbeat::install` diff --git a/manifests/config.pp b/manifests/config.pp index db3327b..cc871e8 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -7,21 +7,14 @@ class packetbeat::config inherits packetbeat { $validate_cmd = $packetbeat::disable_config_test ? { true => undef, - default => "${packetbeat::path_home}/bin/packetbeat -N -configtest -c %", + default => '/usr/share/packetbeat/bin/packetbeat -N -configtest -c %', } - if $packetbeat::major_version == '5' { $packetbeat_config = delete_undef_values({ 'name' => $packetbeat::beat_name, 'fields' => $packetbeat::fields, 'fields_under_root' => $packetbeat::fields_under_root, 'logging' => $packetbeat::logging, - 'path' => { - 'conf' => $packetbeat::path_conf, - 'data' => $packetbeat::path_data, - 'home' => $packetbeat::path_home, - 'logs' => $packetbeat::path_logs, - }, 'tags' => $packetbeat::tags, 'processors' => $packetbeat::processors, 'packetbeat' => { @@ -47,12 +40,6 @@ 'fields' => $packetbeat::fields, 'fields_under_root' => $packetbeat::fields_under_root, 'logging' => $packetbeat::logging, - 'path' => { - 'conf' => $packetbeat::path_conf, - 'data' => $packetbeat::path_data, - 'home' => $packetbeat::path_home, - 'logs' => $packetbeat::path_logs, - }, 'tags' => $packetbeat::tags, 'processors' => $packetbeat::processors, 'packetbeat' => { @@ -89,11 +76,11 @@ file{'packetbeat.yml': ensure => $packetbeat::ensure, - path => "${packetbeat::path_conf}/packetbeat.yml", + path => '/etc/packetbeat/packetbeat.yml', owner => 'root', group => 'root', mode => $packetbeat::config_file_mode, - content => inline_template("### Packetbeat configuration managed by Puppet ###\n\n<%= @packetbeat_config.to_yaml() %>"), + content => inline_template('<%= @packetbeat_config.to_yaml() %>'), validate_cmd => $validate_cmd, } } diff --git a/manifests/init.pp b/manifests/init.pp index 806cf34..e42c213 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -78,19 +78,6 @@ # * `package_ensure` # [String] The state the packetbeat package should be in. (default: present) # -# * `path_conf` -# [Absolute Path] The location of the configuration files. This setting -# also controls the path to `packetbeat.yml`. -# -# * `path_data` -# [Absolute Path] The location of the persistent data files. -# -# * `path_home` -# [Absolute Path] The home of the Packetbeat configuration. -# -# * `path_logs` -# [Absolute Path] The location of the logs created by Packetbeat. -# # * `processors` # Optional[Array[Hash]] Configure processors to perform filtering, # enhancing or additional decoding of data before being sent to the @@ -200,10 +187,6 @@ Enum['5', '6'] $major_version = '5', Boolean $manage_repo = true, String $package_ensure = 'present', - Stdlib::Absolutepath $path_conf = '/etc/packetbeat', - Stdlib::Absolutepath $path_data = '/var/lib/packetbeat', - Stdlib::Absolutepath $path_home = '/usr/share/packetbeat', - Stdlib::Absolutepath $path_logs = '/var/log/packetbeat', Optional[Array[Hash]] $processors = undef, Hash $queue = { 'mem' => { diff --git a/spec/classes/packetbeat_spec.rb b/spec/classes/packetbeat_spec.rb index 75c37db..f78835f 100644 --- a/spec/classes/packetbeat_spec.rb +++ b/spec/classes/packetbeat_spec.rb @@ -287,6 +287,30 @@ it { is_expected.to contain_class('packetbeat::service') } end + context 'with path_conf param' do + let(:params) { { 'path_conf' => '/etc/packetbeat' } } + + it { is_expected.not_to compile } + end + + context 'with path_data param' do + let(:params) { { 'path_data' => '/var/lib/packetbeat' } } + + it { is_expected.not_to compile } + end + + context 'with path_home param' do + let(:params) { { 'path_home' => '/usr/share/packetbeat' } } + + it { is_expected.not_to compile } + end + + context 'with path_logs param' do + let(:params) { { 'path_logs' => '/var/lgs/packetbeat' } } + + it { is_expected.not_to compile } + end + context 'with sniff_type = pf_ring' do let :params do {