Skip to content

Commit

Permalink
Add upgrade/version handling for splunkforwarder
Browse files Browse the repository at this point in the history
- Change "ensure" to an explicit version (otherwise only the file in /opt/staging will be added when $version is bumped)
- Extra handling of accepting the license
- Limit `ensure => version` to RedHat, the 'dpkg' provider is not versionable, so only specify version on osfamily RedHat.

`ensure => absent` for the ftr file might even completely replace `Exec['license_splunkforwarder']` eventually (untested, however)
  • Loading branch information
arjenz committed Dec 12, 2017
1 parent d926bc9 commit a764ccf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions manifests/forwarder.pp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@
}
}

# To make sure upgrades also don't ask for licensing
# Cannot run before license_splunkforwarder (or that will fail)
# Cannot run before the service is started (or that will complain about license)
file { "${forwarder_dir}/ftr" :
ensure => absent,
require => Exec['license_splunkforwarder'],
before => Service[$virtual_service],
}

file { "${forwarder_confdir}/system/local/deploymentclient.conf":
ensure => file,
tag => 'splunk_forwarder',
Expand Down
9 changes: 8 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,14 @@
$forwarder_pkg_src = "${src_root}/products/universalforwarder/releases/${version}/${forwarder_src_subdir}/${forwarder_src_pkg}"
$create_password = true

$forwarder_pkg_ensure = 'installed'
case $osfamily {
'RedHat': {
$forwarder_pkg_ensure = $version
}
default: {
$forwarder_pkg_ensure = 'installed'
}
}

# A meta resource so providers know where splunk is installed:
splunk_config { 'splunk':
Expand Down

0 comments on commit a764ccf

Please sign in to comment.