2021-10-10 05:23:49 +00:00
|
|
|
---
|
2021-08-13 08:05:57 +00:00
|
|
|
|
|
|
|
- name: Record Element-Web 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 }}"
|
|
|
|
insertafter: '# Element Settings Start'
|
|
|
|
with_dict:
|
|
|
|
'matrix_client_element_enabled': '{{ matrix_client_element_enabled }}'
|
2021-10-11 03:20:28 +00:00
|
|
|
'matrix_client_element_jitsi_preferredDomain': 'jitsi.{{ matrix_domain }}'
|
2021-08-13 08:05:57 +00:00
|
|
|
'matrix_client_element_default_theme': '{{ matrix_client_element_default_theme }}'
|
|
|
|
'matrix_client_element_registration_enabled': '{{ matrix_client_element_registration_enabled }}'
|
2021-10-11 07:00:11 +00:00
|
|
|
'matrix_client_element_brand': '{{ matrix_client_element_brand | trim }}'
|
|
|
|
'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl | trim }}'
|
|
|
|
'matrix_client_element_welcome_logo': '{{ matrix_client_element_welcome_logo | trim }}'
|
|
|
|
'matrix_client_element_welcome_logo_link': '{{ matrix_client_element_welcome_logo_link | trim }}'
|
2021-08-13 08:05:57 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Record Element-Web custom variables locally on AWX
|
2021-10-11 04:55:49 +00:00
|
|
|
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:
|
2021-10-11 07:00:11 +00:00
|
|
|
'awx_matrix_client_element_welcome_headline': '{{ awx_matrix_client_element_welcome_headline | trim }}'
|
|
|
|
'awx_matrix_client_element_welcome_text': '{{ awx_matrix_client_element_welcome_text | trim }}'
|
2021-10-11 04:55:49 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Set Element-Web custom branding locally on AWX
|
2021-10-11 03:20:28 +00:00
|
|
|
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:
|
2021-10-11 05:34:46 +00:00
|
|
|
'matrix_client_element_brand': "{{ matrix_client_element_brand }}"
|
|
|
|
when: matrix_client_element_brand | trim | length > 0
|
2021-10-11 03:20:28 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Remove Element-Web custom branding locally on AWX if not defined
|
2021-10-11 03:20:28 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^matrix_client_element_brand: "
|
|
|
|
state: absent
|
2021-10-11 05:34:46 +00:00
|
|
|
when: matrix_client_element_brand | trim | length == 0
|
2021-10-11 03:20:28 +00:00
|
|
|
|
2021-10-07 04:53:32 +00:00
|
|
|
- name: Set fact for 'https' string
|
|
|
|
set_fact:
|
|
|
|
awx_https_string: "https"
|
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Set Element-Web custom logo locally on AWX if defined
|
2021-10-07 04:49:59 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^#? *{{ item.key | regex_escape() }}:"
|
2021-10-10 08:16:31 +00:00
|
|
|
line: "{{ item.key }}: '{{ item.value }}'"
|
2021-10-07 04:49:59 +00:00
|
|
|
insertafter: '# Element Settings Start'
|
|
|
|
with_dict:
|
2021-10-11 05:34:46 +00:00
|
|
|
'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 )
|
2021-10-07 04:49:59 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Remove Element-Web custom logo locally on AWX if not defined
|
2021-10-07 04:49:59 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^matrix_client_element_welcome_logo: "
|
|
|
|
state: absent
|
2021-10-11 05:34:46 +00:00
|
|
|
when: matrix_client_element_welcome_logo | trim | length == 0
|
2021-10-08 06:18:59 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Set Element-Web custom logo link locally on AWX if defined
|
2021-10-08 06:18:59 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^#? *{{ item.key | regex_escape() }}:"
|
2021-10-10 08:16:31 +00:00
|
|
|
line: "{{ item.key }}: '{{ item.value }}'"
|
2021-10-08 06:18:59 +00:00
|
|
|
insertafter: '# Element Settings Start'
|
|
|
|
with_dict:
|
2021-10-11 04:15:15 +00:00
|
|
|
'matrix_client_element_welcome_logo_link': '{{ matrix_client_element_welcome_logo_link }}'
|
2021-10-11 05:34:46 +00:00
|
|
|
when: ( awx_https_string in matrix_client_element_welcome_logo_link ) and ( matrix_client_element_welcome_logo_link | trim | length > 0 )
|
2021-10-08 06:18:59 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Remove Element-Web custom logo link locally on AWX if not defined
|
2021-10-08 06:18:59 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^matrix_client_element_welcome_logo_link: "
|
|
|
|
state: absent
|
2021-10-11 05:34:46 +00:00
|
|
|
when: matrix_client_element_welcome_logo_link | trim | length == 0
|
2021-10-08 06:18:59 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Set Element-Web custom headline locally on AWX if defined
|
2021-10-08 06:18:59 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^#? *{{ item.key | regex_escape() }}:"
|
2021-10-10 08:16:31 +00:00
|
|
|
line: "{{ item.key }}: '{{ item.value }}'"
|
2021-10-08 06:18:59 +00:00
|
|
|
insertafter: '# Element Settings Start'
|
|
|
|
with_dict:
|
2021-10-11 04:55:49 +00:00
|
|
|
'matrix_client_element_welcome_headline': '{{ awx_matrix_client_element_welcome_headline }}'
|
|
|
|
when: awx_matrix_client_element_welcome_headline | trim | length > 0
|
2021-10-08 06:18:59 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Remove Element-Web custom headline locally on AWX if not defined
|
2021-10-08 06:18:59 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^matrix_client_element_welcome_headline: "
|
|
|
|
state: absent
|
2021-10-11 04:55:49 +00:00
|
|
|
when: awx_matrix_client_element_welcome_headline | trim | length == 0
|
2021-10-08 06:18:59 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Set Element-Web custom text locally on AWX if defined
|
2021-10-08 06:18:59 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
2021-10-08 06:28:37 +00:00
|
|
|
regexp: "^#? *{{ item.key | regex_escape() }}:"
|
2021-10-10 08:16:31 +00:00
|
|
|
line: "{{ item.key }}: '{{ item.value }}'"
|
2021-10-08 06:28:37 +00:00
|
|
|
insertafter: '# Element Settings Start'
|
|
|
|
with_dict:
|
2021-10-11 04:55:49 +00:00
|
|
|
'matrix_client_element_welcome_text': '{{ awx_matrix_client_element_welcome_text }}'
|
|
|
|
when: awx_matrix_client_element_welcome_text | trim | length > 0
|
2021-10-08 06:28:37 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Remove Element-Web custom text locally on AWX if not defined
|
2021-10-08 06:28:37 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^matrix_client_element_welcome_text: "
|
2021-10-08 06:18:59 +00:00
|
|
|
state: absent
|
2021-10-11 04:55:49 +00:00
|
|
|
when: awx_matrix_client_element_welcome_text | trim | length == 0
|
2021-10-07 04:49:59 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Set Element-Web background locally on AWX if defined
|
2021-08-13 08:05:57 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^#? *{{ item.key | regex_escape() }}:"
|
2021-10-10 08:16:31 +00:00
|
|
|
line: "{{ item.key }}: '{{ item.value }}'"
|
2021-08-13 08:05:57 +00:00
|
|
|
insertafter: '# Element Settings Start'
|
|
|
|
with_dict:
|
2021-10-11 07:00:11 +00:00
|
|
|
'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl }}'
|
|
|
|
when: matrix_client_element_branding_welcomeBackgroundUrl | trim | length > 0
|
2021-10-11 02:37:02 +00:00
|
|
|
|
2021-10-11 04:57:16 +00:00
|
|
|
- name: Remove Element-Web background locally on AWX if not defined
|
2021-10-11 02:37:02 +00:00
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
lineinfile:
|
|
|
|
path: '{{ awx_cached_matrix_vars }}'
|
|
|
|
regexp: "^matrix_client_element_branding_welcomeBackgroundUrl: "
|
|
|
|
state: absent
|
2021-10-11 07:00:11 +00:00
|
|
|
when: matrix_client_element_branding_welcomeBackgroundUrl | trim | length == 0
|
2021-08-13 08:05:57 +00:00
|
|
|
|
|
|
|
- name: Save new 'Configure Element' survey.json to the AWX tower, template
|
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
template:
|
|
|
|
src: 'roles/matrix-awx/surveys/configure_element.json.j2'
|
|
|
|
dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element.json'
|
|
|
|
|
|
|
|
- name: Copy new 'Configure Element' survey.json to target machine
|
|
|
|
copy:
|
|
|
|
src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element.json'
|
|
|
|
dest: '/matrix/awx/configure_element.json'
|
|
|
|
mode: '0660'
|
|
|
|
|
|
|
|
- name: Recreate 'Configure Element' job template
|
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
awx.awx.tower_job_template:
|
|
|
|
name: "{{ matrix_domain }} - 1 - Configure Element"
|
|
|
|
description: "Configure Element client via survey."
|
|
|
|
extra_vars: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/extra_vars.json') }}"
|
|
|
|
job_type: run
|
|
|
|
job_tags: "start,setup-client-element"
|
|
|
|
inventory: "{{ member_id }}"
|
|
|
|
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
|
|
|
playbook: setup.yml
|
|
|
|
credential: "{{ member_id }} - AWX SSH Key"
|
|
|
|
survey_enabled: true
|
|
|
|
survey_spec: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element.json') }}"
|
|
|
|
become_enabled: yes
|
|
|
|
state: present
|
|
|
|
verbosity: 1
|
2021-10-01 10:56:38 +00:00
|
|
|
tower_host: "https://{{ awx_host }}"
|
|
|
|
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
|
2021-08-13 08:05:57 +00:00
|
|
|
validate_certs: yes
|