Ansible: restart splunk returning exit code



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)...  

Waiting for web server at 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 (3)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...