From 3237b9814c83c53bdb934157b753852d45ebb35b Mon Sep 17 00:00:00 2001 From: admingit Date: Fri, 3 Mar 2023 18:31:15 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'roles/splunk=5Fcom?= =?UTF-8?q?mon=5Fuf/tasks/pre=5Finstall=5Fsubtasks/get=5Ffacts.yml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/pre_install_subtasks/get_facts.yml | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/roles/splunk_common_uf/tasks/pre_install_subtasks/get_facts.yml b/roles/splunk_common_uf/tasks/pre_install_subtasks/get_facts.yml index 8a2bc19..7a726ad 100755 --- a/roles/splunk_common_uf/tasks/pre_install_subtasks/get_facts.yml +++ b/roles/splunk_common_uf/tasks/pre_install_subtasks/get_facts.yml @@ -1,53 +1,53 @@ ---- -- 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_uf }}" - 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_uf }}/etc/auth/splunk.secret" - register: pre_existing_splunk_secret - become: yes - -- name: "Set first run fact" - set_fact: - first_run: "{{ not pre_existing_splunk_secret.stat.exists | default(True) }}" - -- 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 manifests" - find: - paths: "{{ splunk_home_uf }}" - 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_uf 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: +--- +- 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: /opt/splunkforwarder/bin/splunk + 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_uf }}/etc/auth/splunk.secret" + register: pre_existing_splunk_secret + become: yes + +- name: "Set first run fact" + set_fact: + first_run: "{{ not pre_existing_splunk_secret.stat.exists | default(True) }}" + +- 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 manifests" + find: + paths: "{{ splunk_home_uf }}" + 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_uf 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 \ No newline at end of file