improve conditional

This commit is contained in:
Michael Collins 2021-10-07 12:53:32 +08:00
parent ecc0437520
commit d1754915d1

View file

@ -23,6 +23,10 @@
with_dict: with_dict:
'ext_matrix_client_element_welcome_logo_raw': '{{ ext_matrix_client_element_welcome_logo_raw }}' '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 - name: Set custom logo URL locally on AWX if defined
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
lineinfile: lineinfile:
@ -32,7 +36,7 @@
insertafter: '# Element Settings Start' insertafter: '# Element Settings Start'
with_dict: with_dict:
'matrix_client_element_welcome_logo': '{{ ext_matrix_client_element_welcome_logo_raw }}' '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 - name: Remove custom logo URL locally on AWX if not defined
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
@ -42,10 +46,6 @@
state: absent state: absent
when: ext_matrix_client_element_welcome_logo_raw|trim|length == 0 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 - name: Record Element-Web Background variable locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
lineinfile: lineinfile:
@ -55,7 +55,7 @@
insertafter: '# Element Settings Start' insertafter: '# Element Settings Start'
with_dict: with_dict:
'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl }}' '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 - name: Save new 'Configure Element' survey.json to the AWX tower, template
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1