|
5 | 5 | class splunk::forwarder::service::nix inherits splunk::forwarder::service {
|
6 | 6 |
|
7 | 7 | if $splunk::forwarder::boot_start {
|
| 8 | + $accept_tos_user = 'root' |
| 9 | + $accept_tos_require = Exec['enable_splunkforwarder'] |
8 | 10 | # Ensure splunk services *not* managed by the system service file are
|
9 | 11 | # gracefully shut down prior to enabling boot-start. Should the service
|
10 | 12 | # file be enabled while binary-managed splunk services are running, you
|
|
36 | 38 | # Commands to license and disable the SplunkUniversalForwarder
|
37 | 39 | #
|
38 | 40 | else {
|
| 41 | + $accept_tos_user = $splunk::forwarder::splunk_user |
| 42 | + $accept_tos_require = Exec['license_splunkforwarder'] |
39 | 43 | # Accept the license when disabling splunk in case system service files are
|
40 | 44 | # present before installing splunk. The splunk package does not remove the
|
41 | 45 | # service files when uninstalled.
|
|
72 | 76 | }
|
73 | 77 | }
|
74 | 78 |
|
| 79 | + # If forwarder is already installed, refresh from package changes |
| 80 | + if $facts['splunkforwarder_version'] { |
| 81 | + $accept_tos_subscribe = Package[$splunk::forwarder::package_name] |
| 82 | + } else { |
| 83 | + $accept_tos_subscribe = undef |
| 84 | + } |
| 85 | + $accept_tos_command = [ |
| 86 | + "${splunk::forwarder::forwarder_homedir}/bin/splunk stop &&", |
| 87 | + "${splunk::forwarder::forwarder_homedir}/bin/splunk start --accept-license --answer-yes &&", |
| 88 | + "${splunk::forwarder::forwarder_homedir}/bin/splunk stop", |
| 89 | + ] |
| 90 | + exec { 'splunk-forwarder-accept-tos': |
| 91 | + command => join($accept_tos_command, ' '), |
| 92 | + user => $accept_tos_user, |
| 93 | + before => Service[$splunk::forwarder::service_name], |
| 94 | + subscribe => $accept_tos_subscribe, |
| 95 | + require => $accept_tos_require, |
| 96 | + refreshonly => true, |
| 97 | + } |
| 98 | + |
75 | 99 | }
|
0 commit comments