From c678556ff0bfa05c6fe4904a9ff033840141cfbc Mon Sep 17 00:00:00 2001 From: Tod Detre Date: Thu, 13 Jun 2024 11:19:22 -0400 Subject: [PATCH] use separte set_fact for bearer token or basic auth download --- .../tasks/install_splunk_tgz.yml | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/roles/splunk_common/tasks/install_splunk_tgz.yml b/roles/splunk_common/tasks/install_splunk_tgz.yml index 609d655d..f2d0c24d 100644 --- a/roles/splunk_common/tasks/install_splunk_tgz.yml +++ b/roles/splunk_common/tasks/install_splunk_tgz.yml @@ -11,8 +11,8 @@ when: - splunk.build_location is match("^(https?)://.*") - splunk.artifact_auth_user is undefined or splunk.artifact_auth_user == "" - register: download_result - until: download_result is succeeded + register: download_result_bearer + until: download_result_bearer is succeeded retries: 5 delay: "{{ retry_delay }}" become: yes @@ -34,17 +34,27 @@ - splunk.build_location is match("^(https?)://.*") - splunk.artifact_auth_user is defined - splunk.artifact_auth_user != "" - register: download_result - until: download_result is succeeded + register: download_result_basic + until: download_result_basic is succeeded retries: 5 delay: "{{ retry_delay }}" become: yes become_user: "{{ privileged_user }}" -- name: Define a path for the downloaded package +- name: Define a path for the downloaded package (bearer token) set_fact: - splunk_downloaded_build_location: "{{ download_result.dest }}" - when: splunk.build_location is match("^(https?)://.*") + splunk_downloaded_build_location: "{{ download_result_bearer.dest }}" + when: + - splunk.build_location is match("^(https?)://.*") + - splunk.artifact_auth_user is undefined or splunk.artifact_auth_user == "" + +- name: Define a path for the downloaded package (basic auth) + set_fact: + splunk_downloaded_build_location: "{{ download_result_basic.dest }}" + when: + - splunk.build_location is match("^(https?)://.*") + - splunk.artifact_auth_user is defined + - splunk.artifact_auth_user != "" - name: Define a regex replacement for splunk.build_location set_fact: