From 291efc1163537f27d04d1661c6518d0f5b95da4a Mon Sep 17 00:00:00 2001 From: Michael Collins Date: Mon, 11 Oct 2021 11:20:28 +0800 Subject: [PATCH] update element section --- .../surveys/configure_element.json.j2 | 24 +++++++++---------- .../tasks/set_variables_element.yml | 21 ++++++++++++++-- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/roles/matrix-awx/surveys/configure_element.json.j2 b/roles/matrix-awx/surveys/configure_element.json.j2 index e5bd7166..490db7d1 100755 --- a/roles/matrix-awx/surveys/configure_element.json.j2 +++ b/roles/matrix-awx/surveys/configure_element.json.j2 @@ -14,18 +14,6 @@ "variable": "matrix_client_element_enabled", "type": "multiplechoice" }, - { - "question_name": "Set Branding for Web Client", - "question_description": "Sets the 'branding' seen in the tab and on the welcome page to a custom value.", - "required": false, - "min": 0, - "max": 256, - "default": "{{ matrix_client_element_brand }}", - "choices": "", - "new_question": true, - "variable": "matrix_client_element_brand", - "type": "text" - }, { "question_name": "Set Theme for Web Client", "question_description": "Sets the default theme for the web client, can be changed later by individual users.", @@ -38,6 +26,18 @@ "variable": "matrix_client_element_default_theme", "type": "multiplechoice" }, + { + "question_name": "Set Branding for Web Client", + "question_description": "Sets the 'branding' seen in the tab and on the welcome page to a custom value.Leaving this field blank will cause the default branding will be used: 'Element'", + "required": false, + "min": 0, + "max": 256, + "default": "{{ matrix_client_element_brand }}", + "choices": "", + "new_question": true, + "variable": "matrix_client_element_brand", + "type": "text" + }, { "question_name": "Set Welcome Page Background", "question_description": "Sets the background image on the welcome page, you should enter a URL to the image you want to use. Must be a 'https' link, otherwise it won't be set. Leaving this field blank will cause the default background to be used.", diff --git a/roles/matrix-awx/tasks/set_variables_element.yml b/roles/matrix-awx/tasks/set_variables_element.yml index 7448fb8d..407b3739 100755 --- a/roles/matrix-awx/tasks/set_variables_element.yml +++ b/roles/matrix-awx/tasks/set_variables_element.yml @@ -9,11 +9,28 @@ insertafter: '# Element Settings Start' with_dict: 'matrix_client_element_enabled': '{{ matrix_client_element_enabled }}' - 'matrix_client_element_jitsi_preferredDomain': '{{ matrix_client_element_jitsi_preferredDomain }}' - 'matrix_client_element_brand': "'{{ matrix_client_element_brand }}'" + 'matrix_client_element_jitsi_preferredDomain': 'jitsi.{{ matrix_domain }}' 'matrix_client_element_default_theme': '{{ matrix_client_element_default_theme }}' 'matrix_client_element_registration_enabled': '{{ matrix_client_element_registration_enabled }}' +- name: Set custom branding 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 }}'" + insertafter: '# Element Settings Start' + with_dict: + 'matrix_client_element_brand': "{{ matrix_client_element_brand }}" + +- name: Remove custom branding locally on AWX if not defined + delegate_to: 127.0.0.1 + lineinfile: + path: '{{ awx_cached_matrix_vars }}' + regexp: "^matrix_client_element_brand: " + state: absent + when: matrix_client_element_brand | trim | length == 0 + - name: Set fact for 'https' string set_fact: awx_https_string: "https"