From 53f4b84d1f2b6e3d88d3d913b26939452a4b6f1f Mon Sep 17 00:00:00 2001 From: Michael Collins Date: Mon, 11 Oct 2021 12:55:49 +0800 Subject: [PATCH] update element section --- .../surveys/configure_element.json.j2 | 24 +++++----- .../tasks/set_variables_element.yml | 47 ++++++++++++------- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/roles/matrix-awx/surveys/configure_element.json.j2 b/roles/matrix-awx/surveys/configure_element.json.j2 index f8b184c2..ef9b5d07 100755 --- a/roles/matrix-awx/surveys/configure_element.json.j2 +++ b/roles/matrix-awx/surveys/configure_element.json.j2 @@ -32,10 +32,10 @@ "required": false, "min": 0, "max": 256, - "default": "{{ matrix_client_element_brand }}", + "default": "{{ awx_matrix_client_element_brand }}", "choices": "", "new_question": true, - "variable": "matrix_client_element_brand", + "variable": "awx_matrix_client_element_brand", "type": "text" }, { @@ -44,10 +44,10 @@ "required": false, "min": 0, "max": 1024, - "default": "{{ matrix_client_element_branding_welcomeBackgroundUrl }}", + "default": "{{ awx_matrix_client_element_branding_welcomeBackgroundUrl }}", "choices": "", "new_question": true, - "variable": "matrix_client_element_branding_welcomeBackgroundUrl", + "variable": "awx_matrix_client_element_branding_welcomeBackgroundUrl", "type": "text" }, { @@ -56,10 +56,10 @@ "required": false, "min": 0, "max": 1024, - "default": "{{ matrix_client_element_welcome_logo }}", + "default": "{{ awx_matrix_client_element_welcome_logo }}", "choices": "", "new_question": true, - "variable": "matrix_client_element_welcome_logo", + "variable": "awx_matrix_client_element_welcome_logo", "type": "text" }, { @@ -68,10 +68,10 @@ "required": false, "min": 0, "max": 1024, - "default": "{{ matrix_client_element_welcome_logo_link }}", + "default": "{{ awx_matrix_client_element_welcome_logo_link }}", "choices": "", "new_question": true, - "variable": "matrix_client_element_welcome_logo_link", + "variable": "awx_matrix_client_element_welcome_logo_link", "type": "text" }, { @@ -80,10 +80,10 @@ "required": false, "min": 0, "max": 512, - "default": "{{ matrix_client_element_welcome_headline }}", + "default": "{{ awx_matrix_client_element_welcome_headline }}", "choices": "", "new_question": true, - "variable": "matrix_client_element_welcome_headline", + "variable": "awx_matrix_client_element_welcome_headline", "type": "text" }, { @@ -92,10 +92,10 @@ "required": false, "min": 0, "max": 2048, - "default": "{{ matrix_client_element_welcome_text }}", + "default": "{{ awx_matrix_client_element_welcome_text }}", "choices": "", "new_question": true, - "variable": "matrix_client_element_welcome_text", + "variable": "awx_matrix_client_element_welcome_text", "type": "text" }, { diff --git a/roles/matrix-awx/tasks/set_variables_element.yml b/roles/matrix-awx/tasks/set_variables_element.yml index db68ba1c..bf4538ab 100755 --- a/roles/matrix-awx/tasks/set_variables_element.yml +++ b/roles/matrix-awx/tasks/set_variables_element.yml @@ -13,6 +13,21 @@ 'matrix_client_element_default_theme': '{{ matrix_client_element_default_theme }}' 'matrix_client_element_registration_enabled': '{{ matrix_client_element_registration_enabled }}' +- name: Record Synapse Custom variables locally on AWX + delegate_to: 127.0.0.1 + lineinfile: + path: '{{ awx_cached_matrix_vars }}' + regexp: "^#? *{{ item.key | regex_escape() }}:" + line: "{{ item.key }}: '{{ item.value }}'" + insertbefore: '# Element Settings End' + with_dict: + 'awx_matrix_client_element_brand': '{{ awx_matrix_client_element_brand }}' + 'awx_matrix_client_element_branding_welcomeBackgroundUrl:' '{{ awx_matrix_client_element_branding_welcomeBackgroundUrl }}' + 'awx_matrix_client_element_welcome_logo': '{{ awx_matrix_client_element_welcome_logo }}' + 'awx_matrix_client_element_welcome_logo_link': '{{ awx_matrix_client_element_welcome_logo_link }}' + 'awx_matrix_client_element_welcome_headline': '{{ awx_matrix_client_element_welcome_headline }}' + 'awx_matrix_client_element_welcome_text': '{{ awx_matrix_client_element_welcome_text }}' + - name: Set custom branding locally on AWX delegate_to: 127.0.0.1 lineinfile: @@ -21,7 +36,7 @@ line: "{{ item.key }}: '{{ item.value }}'" insertafter: '# Element Settings Start' with_dict: - 'matrix_client_element_brand': "{{ matrix_client_element_brand }}" + 'matrix_client_element_brand': "{{ awx_matrix_client_element_brand }}" - name: Remove custom branding locally on AWX if not defined delegate_to: 127.0.0.1 @@ -29,7 +44,7 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^matrix_client_element_brand: " state: absent - when: matrix_client_element_brand | trim | length == 0 + when: awx_matrix_client_element_brand | trim | length == 0 - name: Set fact for 'https' string set_fact: @@ -43,8 +58,8 @@ line: "{{ item.key }}: '{{ item.value }}'" insertafter: '# Element Settings Start' with_dict: - 'matrix_client_element_welcome_logo': '{{ matrix_client_element_welcome_logo }}' - when: ( awx_https_string in matrix_client_element_welcome_logo ) and ( matrix_client_element_welcome_logo | trim | length > 0 ) + 'matrix_client_element_welcome_logo': '{{ awx_matrix_client_element_welcome_logo }}' + when: ( awx_https_string in awx_matrix_client_element_welcome_logo ) and ( awx_matrix_client_element_welcome_logo | trim | length > 0 ) - name: Remove custom logo locally on AWX if not defined delegate_to: 127.0.0.1 @@ -52,7 +67,7 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^matrix_client_element_welcome_logo: " state: absent - when: matrix_client_element_welcome_logo | trim | length == 0 + when: awx_matrix_client_element_welcome_logo | trim | length == 0 - name: Set custom logo link locally on AWX if defined delegate_to: 127.0.0.1 @@ -63,7 +78,7 @@ insertafter: '# Element Settings Start' with_dict: 'matrix_client_element_welcome_logo_link': '{{ matrix_client_element_welcome_logo_link }}' - when: ( awx_https_string in matrix_client_element_welcome_logo_link ) and ( matrix_client_element_welcome_logo_link | trim | length > 0 ) + when: ( awx_https_string in awx_matrix_client_element_welcome_logo_link ) and ( awx_matrix_client_element_welcome_logo_link | trim | length > 0 ) - name: Remove custom logo link locally on AWX if not defined delegate_to: 127.0.0.1 @@ -71,7 +86,7 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^matrix_client_element_welcome_logo_link: " state: absent - when: matrix_client_element_welcome_logo_link | trim | length == 0 + when: awx_matrix_client_element_welcome_logo_link | trim | length == 0 - name: Set custom headline locally on AWX if defined delegate_to: 127.0.0.1 @@ -81,8 +96,8 @@ line: "{{ item.key }}: '{{ item.value }}'" insertafter: '# Element Settings Start' with_dict: - 'matrix_client_element_welcome_headline': '{{ matrix_client_element_welcome_headline }}' - when: matrix_client_element_welcome_headline | trim | length > 0 + 'matrix_client_element_welcome_headline': '{{ awx_matrix_client_element_welcome_headline }}' + when: awx_matrix_client_element_welcome_headline | trim | length > 0 - name: Remove custom headline locally on AWX if not defined delegate_to: 127.0.0.1 @@ -90,7 +105,7 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^matrix_client_element_welcome_headline: " state: absent - when: matrix_client_element_welcome_headline | trim | length == 0 + when: awx_matrix_client_element_welcome_headline | trim | length == 0 - name: Set custom text locally on AWX if defined delegate_to: 127.0.0.1 @@ -100,8 +115,8 @@ line: "{{ item.key }}: '{{ item.value }}'" insertafter: '# Element Settings Start' with_dict: - 'matrix_client_element_welcome_text': '{{ matrix_client_element_welcome_text }}' - when: matrix_client_element_welcome_text | trim | length > 0 + 'matrix_client_element_welcome_text': '{{ awx_matrix_client_element_welcome_text }}' + when: awx_matrix_client_element_welcome_text | trim | length > 0 - name: Remove custom text locally on AWX if not defined delegate_to: 127.0.0.1 @@ -109,7 +124,7 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^matrix_client_element_welcome_text: " state: absent - when: matrix_client_element_welcome_text | trim | length == 0 + when: awx_matrix_client_element_welcome_text | trim | length == 0 - name: Set element-web background locally on AWX if defined delegate_to: 127.0.0.1 @@ -119,8 +134,8 @@ line: "{{ item.key }}: '{{ item.value }}'" insertafter: '# Element Settings Start' with_dict: - 'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl }}' - when: matrix_client_element_branding_welcomeBackgroundUrl | trim | length > 0 + 'matrix_client_element_branding_welcomeBackgroundUrl': '{{ awx_matrix_client_element_branding_welcomeBackgroundUrl }}' + when: awx_matrix_client_element_branding_welcomeBackgroundUrl | trim | length > 0 - name: Remove element-web background locally on AWX if not defined delegate_to: 127.0.0.1 @@ -128,7 +143,7 @@ path: '{{ awx_cached_matrix_vars }}' regexp: "^matrix_client_element_branding_welcomeBackgroundUrl: " state: absent - when: matrix_client_element_branding_welcomeBackgroundUrl | trim | length == 0 + when: awx_matrix_client_element_branding_welcomeBackgroundUrl | trim | length == 0 - name: Save new 'Configure Element' survey.json to the AWX tower, template delegate_to: 127.0.0.1