2020-07-17 08:31:20 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
#
|
|
|
|
# Tasks related to setting up Element themes
|
|
|
|
#
|
|
|
|
|
2022-09-27 08:38:33 +00:00
|
|
|
- when: matrix_client_element_themes_enabled | bool
|
|
|
|
run_once: true
|
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
become: false
|
|
|
|
block:
|
2020-07-17 08:31:20 +00:00
|
|
|
- name: Ensure Element themes repository is pulled
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.git:
|
2020-07-17 08:31:20 +00:00
|
|
|
repo: "{{ matrix_client_element_themes_repository_url }}"
|
2022-07-18 11:43:52 +00:00
|
|
|
version: "{{ matrix_client_element_themes_repository_version }}"
|
2020-07-17 08:31:20 +00:00
|
|
|
dest: "{{ role_path }}/files/scratchpad/themes"
|
|
|
|
|
|
|
|
- name: Find all Element theme files
|
2022-07-18 08:22:05 +00:00
|
|
|
ansible.builtin.find:
|
2020-07-17 08:31:20 +00:00
|
|
|
paths: "{{ role_path }}/files/scratchpad/themes"
|
|
|
|
patterns: "*.json"
|
|
|
|
recurse: true
|
|
|
|
register: matrix_client_element_theme_file_list
|
|
|
|
|
|
|
|
- name: Read Element theme
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.slurp:
|
2020-07-17 08:31:20 +00:00
|
|
|
path: "{{ item.path }}"
|
|
|
|
register: "matrix_client_element_theme_file_contents"
|
|
|
|
with_items: "{{ matrix_client_element_theme_file_list.files }}"
|
|
|
|
|
|
|
|
- name: Load Element theme
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.set_fact:
|
2022-07-18 13:43:12 +00:00
|
|
|
matrix_client_element_settingDefaults_custom_themes: "{{ matrix_client_element_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}" # noqa var-naming
|
2020-07-17 08:31:20 +00:00
|
|
|
with_items: "{{ matrix_client_element_theme_file_contents.results }}"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Tasks related to getting rid of Element themes (if it was previously enabled)
|
|
|
|
#
|
|
|
|
|
|
|
|
- name: Ensure Element themes repository is removed
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.file:
|
2020-07-17 08:31:20 +00:00
|
|
|
path: "{{ role_path }}/files/scratchpad/themes"
|
|
|
|
state: absent
|
|
|
|
run_once: true
|
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
become: false
|
2022-07-18 08:22:05 +00:00
|
|
|
when: "not matrix_client_element_themes_enabled | bool"
|