From 4e2b11b3aa05ed501f46934f15f36615c8f1df19 Mon Sep 17 00:00:00 2001 From: Matt Haught Date: Thu, 7 Apr 2022 13:44:07 -0400 Subject: [PATCH 1/3] add proxy support --- manifests/enterprise.pp | 8 ++++++++ manifests/enterprise/install.pp | 8 +++++--- manifests/forwarder.pp | 8 ++++++++ manifests/forwarder/install.pp | 9 ++++++--- manifests/params.pp | 8 ++++++++ 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/manifests/enterprise.pp b/manifests/enterprise.pp index 0c5e3700..5bccdb6b 100644 --- a/manifests/enterprise.pp +++ b/manifests/enterprise.pp @@ -171,6 +171,12 @@ # @param secret # The secret used to salt the splunk password. # +# @param install_proxy +# Proxy used to install Splunk enterprise package. +# +# @param install_proxy_type +# Proxy type used to install Splunk enterprise package. +# class splunk::enterprise ( String[1] $version = $splunk::params::version, String[1] $package_name = $splunk::params::enterprise_package_name, @@ -220,6 +226,8 @@ String[1] $seed_user = $splunk::params::seed_user, Stdlib::Absolutepath $secret_file = $splunk::params::enterprise_secret_file, String[1] $secret = $splunk::params::secret, + String[1] $install_proxy = $splunk::params::install_proxy, + String[1] $install_proxy_type = $splunk::params::install_proxy_type, ) inherits splunk { if (defined(Class['splunk::forwarder'])) { fail('Splunk Universal Forwarder provides a subset of Splunk Enterprise capabilities, and has potentially conflicting resources when included with Splunk Enterprise on the same node. Do not include splunk::forwarder on the same node as splunk::enterprise. Configure Splunk Enterprise to meet your forwarding needs.' diff --git a/manifests/enterprise/install.pp b/manifests/enterprise/install.pp index e9be73a7..696f194e 100644 --- a/manifests/enterprise/install.pp +++ b/manifests/enterprise/install.pp @@ -19,9 +19,11 @@ $_staged_package = join($_package_path_parts, $splunk::enterprise::path_delimiter) archive { $_staged_package: - source => $_package_source, - extract => false, - before => Package[$splunk::enterprise::package_name], + source => $_package_source, + extract => false, + before => Package[$splunk::enterprise::package_name], + proxy_server => $splunk::enterprise::install_proxy, + proxy_type => $splunk::enterprise::install_proxy_type, } } else { $_staged_package = undef diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index 9d8e7442..982c96b2 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -150,6 +150,12 @@ # @param addons # Manage a splunk addons, see `splunk::addons`. # +# @param install_proxy +# Proxy used to install Splunk forwarder package. +# +# @param install_proxy_type +# Proxy type used to install Splunk forwarder package. +# class splunk::forwarder ( String[1] $server = $splunk::params::server, String[1] $version = $splunk::params::version, @@ -191,6 +197,8 @@ Stdlib::Absolutepath $secret_file = $splunk::params::forwarder_secret_file, String[1] $secret = $splunk::params::secret, Hash $addons = {}, + String[1] $install_proxy = $splunk::params::install_proxy, + String[1] $install_proxy_type = $splunk::params::install_proxy_type, ) inherits splunk { if (defined(Class['splunk::enterprise'])) { fail('Splunk Universal Forwarder provides a subset of Splunk Enterprise capabilities, and has potentially conflicting resources when included with Splunk Enterprise on the same node. Do not include splunk::forwarder on the same node as splunk::enterprise. Configure Splunk Enterprise to meet your forwarding needs.' diff --git a/manifests/forwarder/install.pp b/manifests/forwarder/install.pp index 22c3d4ec..80032751 100644 --- a/manifests/forwarder/install.pp +++ b/manifests/forwarder/install.pp @@ -15,9 +15,12 @@ $_staged_package = join($_package_path_parts, $splunk::forwarder::path_delimiter) archive { $_staged_package: - source => $_package_source, - extract => false, - before => Package[$splunk::forwarder::forwarder_package_name], + source => $_package_source, + extract => false, + before => Package[$splunk::forwarder::forwarder_package_name], + proxy_server => $splunk::forwarder::install_proxy, + proxy_type => $splunk::forwarder::install_proxy_type, + } } else { $_staged_package = undef diff --git a/manifests/params.pp b/manifests/params.pp index 7b3f1fbc..5fc5d992 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -89,6 +89,12 @@ # @param enterprise_installdir # Optional directory in which to install and manage Splunk Enterprise # +# @param install_proxy +# Optional proxy server URL for installing packages. +# +# @param install_proxy_type +# Optional proxy type (none|http|https|ftp). +# # @param default_host # The host property in inputs.conf. Defaults to the server's hostname. # @@ -106,6 +112,8 @@ String[1] $server = 'splunk', Optional[String[1]] $forwarder_installdir = undef, Optional[String[1]] $enterprise_installdir = undef, + Optional[String[1]] $install_proxy = undef, + Optional[String[1]] $install_proxy_type = undef, Boolean $boot_start = true, String[1] $splunk_user = $facts['os']['family'] ? { 'windows' => 'Administrator', From 292ff4cd10b7cff5a879594434005dc3be7c7801 Mon Sep 17 00:00:00 2001 From: Matt Haught Date: Thu, 7 Apr 2022 14:32:29 -0400 Subject: [PATCH 2/3] make proxy optional --- manifests/enterprise.pp | 4 ++-- manifests/forwarder.pp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/enterprise.pp b/manifests/enterprise.pp index 5bccdb6b..23ddbf4a 100644 --- a/manifests/enterprise.pp +++ b/manifests/enterprise.pp @@ -226,8 +226,8 @@ String[1] $seed_user = $splunk::params::seed_user, Stdlib::Absolutepath $secret_file = $splunk::params::enterprise_secret_file, String[1] $secret = $splunk::params::secret, - String[1] $install_proxy = $splunk::params::install_proxy, - String[1] $install_proxy_type = $splunk::params::install_proxy_type, + Optional[String[1]] $install_proxy = $splunk::params::install_proxy, + Optional[String[1]] $install_proxy_type = $splunk::params::install_proxy_type, ) inherits splunk { if (defined(Class['splunk::forwarder'])) { fail('Splunk Universal Forwarder provides a subset of Splunk Enterprise capabilities, and has potentially conflicting resources when included with Splunk Enterprise on the same node. Do not include splunk::forwarder on the same node as splunk::enterprise. Configure Splunk Enterprise to meet your forwarding needs.' diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index 982c96b2..323e27a2 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -197,8 +197,8 @@ Stdlib::Absolutepath $secret_file = $splunk::params::forwarder_secret_file, String[1] $secret = $splunk::params::secret, Hash $addons = {}, - String[1] $install_proxy = $splunk::params::install_proxy, - String[1] $install_proxy_type = $splunk::params::install_proxy_type, + Optional[String[1]] $install_proxy = $splunk::params::install_proxy, + Optional[String[1]] $install_proxy_type = $splunk::params::install_proxy_type, ) inherits splunk { if (defined(Class['splunk::enterprise'])) { fail('Splunk Universal Forwarder provides a subset of Splunk Enterprise capabilities, and has potentially conflicting resources when included with Splunk Enterprise on the same node. Do not include splunk::forwarder on the same node as splunk::enterprise. Configure Splunk Enterprise to meet your forwarding needs.' From 8bbc4a89f0cf744956dadecca6a578520f782f87 Mon Sep 17 00:00:00 2001 From: Matt Haught Date: Thu, 7 Apr 2022 15:16:20 -0400 Subject: [PATCH 3/3] cleanup whitespace --- manifests/forwarder/install.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/forwarder/install.pp b/manifests/forwarder/install.pp index 80032751..c3a6764b 100644 --- a/manifests/forwarder/install.pp +++ b/manifests/forwarder/install.pp @@ -20,7 +20,6 @@ before => Package[$splunk::forwarder::forwarder_package_name], proxy_server => $splunk::forwarder::install_proxy, proxy_type => $splunk::forwarder::install_proxy_type, - } } else { $_staged_package = undef