Installation

Ansible: restart splunk returning exit code

callemang
Explorer

Hello!

I am using Ansible to automate Splunk operations. I have a handler that simply runs:

 

- name: restart splunk
  shell: "{{ splunk_home }}/bin/splunk restart"
  become: yes
  become_user: "{{ splunk_nix_user }}"

 

Occasionally (1 out of every 5), this command will return an exit code with the following output.

 

[...]
All preliminary checks passed.

Starting splunk server daemon (splunkd)...  
Done

Waiting for web server at https://127.0.0.1:8443 to be available.....

WARNING: web interface does not seem to be available!

 

This causes my Ansible Tower job to fail and send out failure notifications to the team. Seconds later, the web interface is available and all is well (except for my pride because of the failure notification).

 

Is there any way to have Splunk wait longer to check for the web UI to be up? Or possibly a way for Ansible to not fail on this exit code or zero?

 

Any help is much appreciated

Labels (2)
Tags (1)
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 ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...