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.
56 lines
1.7 KiB
56 lines
1.7 KiB
---
|
|
- name: "Set privilege escalation user"
|
|
set_fact:
|
|
privileged_user: "{% if ansible_system is match('CYGWIN*|Win32NT') %}Administrator{% else %}root{% endif %}"
|
|
|
|
- name: "Check for existing installation"
|
|
stat:
|
|
path: "{{ splunk_exec }}"
|
|
become: yes
|
|
register: pre_existing_splunk_exec
|
|
|
|
- name: "Set splunk install fact"
|
|
set_fact:
|
|
splunk_install: "{{ not pre_existing_splunk_exec.stat.exists | default(True) }}"
|
|
|
|
- name: "Check for existing splunk secret"
|
|
stat:
|
|
path: "{{ splunk_home }}/etc/auth/splunk.secret"
|
|
register: pre_existing_splunk_secret
|
|
become: yes
|
|
become_user: "{{ privileged_user }}"
|
|
|
|
- name: "Set first run fact"
|
|
set_fact:
|
|
first_run: "{{ not pre_existing_splunk_secret.stat.exists | default(True) }}"
|
|
become: yes
|
|
become_user: "{{ privileged_user }}"
|
|
|
|
- name : "Set splunk_build_type fact"
|
|
include_tasks: get_facts_build_type.yml
|
|
|
|
- name: "Set target version fact"
|
|
include_tasks: get_facts_target_version.yml
|
|
when: splunk_target_version is not defined or splunk_target_version == none
|
|
|
|
- name: "Find manifest"
|
|
find:
|
|
paths: "{{ splunk_home }}"
|
|
patterns: ".*-manifest$"
|
|
use_regex: yes
|
|
become: yes
|
|
register: manifests
|
|
|
|
- name: "Set current version fact"
|
|
set_fact:
|
|
splunk_current_version: "{{ manifests.files[0].path | regex_search(regexp, '\\1') if (manifests.matched == 1) else '0' }}"
|
|
vars:
|
|
regexp: 'splunk\D*?-((\d+)\.(\d+)\.(\d+))'
|
|
|
|
- name: "Setting upgrade fact"
|
|
set_fact:
|
|
splunk_upgrade: "{{ splunk_build_location and not splunk_install and splunk_target_version and splunk_target_version != splunk_current_version | default(False) }}"
|
|
|
|
- name: "Register the fact that we've gather the fact"
|
|
set_fact:
|
|
splunk_get_fact: true |