From 6c143b3380a6a4b2c81a19c2ab68db000bef0de1 Mon Sep 17 00:00:00 2001 From: Luis Silva Date: Tue, 15 Oct 2024 12:20:11 -0400 Subject: [PATCH] need to disable service upstream when service set to absent --- manifests/forwarder/service.pp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/manifests/forwarder/service.pp b/manifests/forwarder/service.pp index 8d616aeb..c3c7d739 100644 --- a/manifests/forwarder/service.pp +++ b/manifests/forwarder/service.pp @@ -4,10 +4,19 @@ # sub-classes # class splunk::forwarder::service { - service { $splunk::forwarder::service_name: - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, + if $splunk::forwarder::package_ensure == absent { + service { $splunk::forwarder::service_name: + ensure => stopped, + enable => false, + hasstatus => false, + hasrestart => false, + } + } else { + service { $splunk::forwarder::service_name: + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + } } }