You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

---
- name: "Get Splunk status"
command: "{{ splunk_exec }} status --accept-license --answer-yes --no-prompt"
become: yes
become_user: "{{ splunk_user }}"
register: splunk_status
changed_when: False
failed_when: False
ignore_errors: yes
- name: "Start Splunk via cli"
command: "{{ splunk_exec }} start --accept-license --answer-yes --no-prompt"
become: yes
become_user: "{{ splunk_user }}"
register: start_splunk
changed_when: start_splunk.rc == 0 and 'already running' not in start_splunk.stdout
when:
- not splunk_enable_service or pid1 is not defined
- splunk_status.rc != 0
ignore_errors: yes
- name: "Start Splunk via service"
service:
name: "{% if pid1.stdout.find('systemd') != -1 %}Splunkd{% else %}splunk{% endif %}"
state: restarted
when:
- splunk_enable_service
- splunk_status.rc != 0
- ansible_system is match("Linux")
- pid1 is defined
become: yes
become_user: "{{ privileged_user }}"
- name: "Start Splunk via Windows service"
win_service:
name: splunkd
state: restarted
when:
- splunk_enable_service
- splunk_status.rc != 0
- ansible_os_family == "Windows"
- name: "Wait for splunkd management port"
wait_for:
port: "{{ splunk_svc_port }}"