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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

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

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...