From 32f50f0361c51c1d7cf202b98eacd68d94971a49 Mon Sep 17 00:00:00 2001 From: Guillaume Nobiron Date: Thu, 7 Sep 2023 15:36:38 +0200 Subject: [PATCH] add support for features config section --- manifests/config.pp | 12 ++++++++++-- manifests/init.pp | 2 ++ manifests/params.pp | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 0767c75..f9d5391 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -56,11 +56,19 @@ }) # Add the 'xpack' section if supported (version >= 6.1.0) and not undef if $filebeat::xpack and versioncmp($filebeat::package_ensure, '6.1.0') >= 0 { - $filebeat_config = deep_merge($filebeat_config_temp, { 'xpack' => $filebeat::xpack }) + $filebeat_config_xpack = deep_merge($filebeat_config_temp, { 'xpack' => $filebeat::xpack }) } else { - $filebeat_config = $filebeat_config_temp + $filebeat_config_xpack = $filebeat_config_temp + } + # Add the 'features' section if supported (version >= 8.7.0) and not undef + if $filebeat::features and versioncmp($filebeat::package_ensure, '8.7.0') >= 0 { + $filebeat_config = deep_merge($filebeat_config_xpack, { 'features' => $filebeat::features }) } + else { + $filebeat_config = $filebeat_config_xpack + } + } else { $filebeat_config_temp = delete_undef_values({ 'shutdown_timeout' => $filebeat::shutdown_timeout, diff --git a/manifests/init.pp b/manifests/init.pp index d599c3d..56b88b5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -39,6 +39,7 @@ # @param modules_dir [String] The directory where module configurations should be defined (default: /etc/filebeat/modules.d) # @param http [Hash] A hash of the http section of configuration # @param cloud [Hash] Will be converted to YAML for the optional cloud of the configuration (see documentation, and above) +# @param features [Hash] Will be converted to YAML to create the optional features section of the filebeat config (see documentation) # @param queue [Hash] Will be converted to YAML for the optional queue of the configuration (see documentation, and above) # @param outputs [Hash] Will be converted to YAML for the required outputs section of the configuration (see documentation, and above) # @param shipper [Hash] Will be converted to YAML to create the optional shipper section of the filebeat config (see documentation) @@ -91,6 +92,7 @@ Boolean $enable_conf_modules = $filebeat::params::enable_conf_modules, Hash $http = $filebeat::params::http, Hash $cloud = $filebeat::params::cloud, + Hash $features = $filebeat::params::features, Hash $queue = $filebeat::params::queue, Hash $outputs = $filebeat::params::outputs, Hash $shipper = $filebeat::params::shipper, diff --git a/manifests/params.pp b/manifests/params.pp index ad7edc9..ae79487 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -23,6 +23,7 @@ $ssl = {} $http = {} $cloud = {} + $features = {} $queue = {} $outputs = {} $shipper = {}