From d1754915d130a59176b0ab47db23674e6f57fa13 Mon Sep 17 00:00:00 2001 From: Michael Collins Date: Thu, 7 Oct 2021 12:53:32 +0800 Subject: [PATCH] improve conditional --- roles/matrix-awx/tasks/set_variables_element.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/matrix-awx/tasks/set_variables_element.yml b/roles/matrix-awx/tasks/set_variables_element.yml index c913932cd..9e8e937d0 100755 --- a/roles/matrix-awx/tasks/set_variables_element.yml +++ b/roles/matrix-awx/tasks/set_variables_element.yml @@ -23,6 +23,10 @@ with_dict: 'ext_matrix_client_element_welcome_logo_raw': '{{ ext_matrix_client_element_welcome_logo_raw }}' +- name: Set fact for 'https' string + set_fact: + awx_https_string: "https" + - name: Set custom logo URL locally on AWX if defined delegate_to: 127.0.0.1 lineinfile: @@ -32,7 +36,7 @@ insertafter: '# Element Settings Start' with_dict: 'matrix_client_element_welcome_logo': '{{ ext_matrix_client_element_welcome_logo_raw }}' - when: ext_matrix_client_element_welcome_logo_raw|trim|length > 0 + when: ( awx_https_string in ext_matrix_client_element_welcome_logo_raw ) and ( ext_matrix_client_element_welcome_logo_raw|trim|length > 0 ) - name: Remove custom logo URL locally on AWX if not defined delegate_to: 127.0.0.1 @@ -42,10 +46,6 @@ state: absent when: ext_matrix_client_element_welcome_logo_raw|trim|length == 0 -- name: Set fact for 'https' string - set_fact: - awx_https_string: "https" - - name: Record Element-Web Background variable locally on AWX delegate_to: 127.0.0.1 lineinfile: @@ -55,7 +55,7 @@ insertafter: '# Element Settings Start' with_dict: 'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl }}' - when: (awx_https_string in matrix_client_element_branding_welcomeBackgroundUrl) and ( matrix_client_element_branding_welcomeBackgroundUrl|length > 0 ) + when: ( awx_https_string in matrix_client_element_branding_welcomeBackgroundUrl ) and ( matrix_client_element_branding_welcomeBackgroundUrl|length > 0 ) - name: Save new 'Configure Element' survey.json to the AWX tower, template delegate_to: 127.0.0.1