Installation

Error in upgrading forwarder using ansible

gowthammahes
Path Finder

Hi All,

We are trying to upgrade the splunk universal forwarder from version 8.1.0 to 9.0.3 using ansible scripts. But we are getting error when the script tries to start the forwarder. Herewith attached error and ansible playbook.

Ansible playbook:

- name: Splunk Upgrade | Copy tgz to target
copy:
src: /pub/splunk/splunkpackages/{{ splunk_package }}
dest: /tmp/{{ splunk_package }}

- name: Splunk Upgrade | Check for SYSV scripts
stat:
path: /etc/rc.d/init.d/splunk
register: splunk_sysv

- name: Splunk Upgrade | Stop Splunk
shell: |
{{ splunk_home }}/bin/splunk stop
tar -cvf /opt/splunk_config_backup.tar {{ splunk_home }}/etc/

- name: Splunk Upgrade | Clean up SYSV scripts
shell: |
rm /etc/rc.d/init.d/splunk
/opt/splunkforwarder/bin/splunk disable boot-start
when: splunk_sysv.stat.exists
ignore_errors: yes

- name: Splunk Upgrade | Upgrade Forwarder and restart ==> in this task it getting failed
shell: |
cd /opt
tar -xzvf /tmp/{{ splunk_package }}
chown -R splunk:splunk /opt/splunkforwarder
{{ splunk_home }}/bin/splunk start --accept-license --answer-yes --no-prompt
register: splunk_upgrade

- name: Splunk Upgrade | Convert SYSV to Systemd
shell: |
{{ splunk_home }}/bin/splunk stop
chown -R splunk:splunk /opt/splunkforwarder
/opt/splunkforwarder/bin/splunk enable boot-start -user splunk
when: splunk_sysv.stat.exists

- name: Splunk Upgrade | start and enable splunk
service:
name: SplunkForwarder.service
enabled: true
state: started

- name: Splunk Upgrade | Cleanup tgz
file:
state: absent
path: /tmp/{{ splunk_package }}

 

Error in splunk forwarder log:

gowthammahes_0-1690459358986.png

 

Labels (3)
0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...