From ecc043752060e3610fd8b7fb79d81fd6a99a09f0 Mon Sep 17 00:00:00 2001 From: Michael Collins Date: Thu, 7 Oct 2021 12:49:59 +0800 Subject: [PATCH] add logo section --- .../surveys/configure_element.json.j2 | 12 ++++++++ .../tasks/set_variables_element.yml | 29 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/roles/matrix-awx/surveys/configure_element.json.j2 b/roles/matrix-awx/surveys/configure_element.json.j2 index d85a0ee55..1595b13b6 100755 --- a/roles/matrix-awx/surveys/configure_element.json.j2 +++ b/roles/matrix-awx/surveys/configure_element.json.j2 @@ -50,6 +50,18 @@ "variable": "matrix_client_element_branding_welcomeBackgroundUrl", "type": "text" }, + { + "question_name": "Set Welcome Page Logo", + "question_description": "Sets the logo found on the welcome and login page, must be approximately heightXwidth.", + "required": false, + "min": 0, + "max": 1024, + "default": "{{ ext_matrix_client_element_welcome_logo_raw }}", + "choices": "", + "new_question": true, + "variable": "ext_matrix_client_element_welcome_logo_raw", + "type": "text" + }, { "question_name": "Show Registration Button", "question_description": "If you show the registration button on the welcome page.", diff --git a/roles/matrix-awx/tasks/set_variables_element.yml b/roles/matrix-awx/tasks/set_variables_element.yml index 233a49fe3..c913932cd 100755 --- a/roles/matrix-awx/tasks/set_variables_element.yml +++ b/roles/matrix-awx/tasks/set_variables_element.yml @@ -13,6 +13,35 @@ 'matrix_client_element_default_theme': '{{ matrix_client_element_default_theme }}' 'matrix_client_element_registration_enabled': '{{ matrix_client_element_registration_enabled }}' +- name: Record Element-Web 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: '# Custom Settings Start' + with_dict: + 'ext_matrix_client_element_welcome_logo_raw': '{{ ext_matrix_client_element_welcome_logo_raw }}' + +- name: Set custom logo URL locally on AWX if defined + 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_welcome_logo': '{{ ext_matrix_client_element_welcome_logo_raw }}' + when: 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 + lineinfile: + path: '{{ awx_cached_matrix_vars }}' + regexp: "^matrix_client_element_welcome_logo: " + 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"