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!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...