matrix-docker-ansible-deploy/roles/custom/matrix-client-schildichat/tasks/prepare_themes.yml

48 lines
1.6 KiB
YAML
Raw Normal View History

2023-08-30 18:23:52 +02:00
---
#
# Tasks related to setting up SchildiChat themes
2023-08-30 18:23:52 +02:00
#
- when: matrix_client_schildichat_themes_enabled | bool
run_once: true
delegate_to: 127.0.0.1
become: false
block:
- name: Ensure SchildiChat themes repository is pulled
2023-08-30 18:23:52 +02:00
ansible.builtin.git:
repo: "{{ matrix_client_schildichat_themes_repository_url }}"
version: "{{ matrix_client_schildichat_themes_repository_version }}"
dest: "{{ role_path }}/files/scratchpad/themes"
- name: Find all SchildiChat theme files
2023-08-30 18:23:52 +02:00
ansible.builtin.find:
paths: "{{ role_path }}/files/scratchpad/themes"
patterns: "*.json"
recurse: true
register: matrix_client_schildichat_theme_file_list
- name: Read SchildiChat theme
2023-08-30 18:23:52 +02:00
ansible.builtin.slurp:
path: "{{ item.path }}"
register: "matrix_client_schildichat_theme_file_contents"
with_items: "{{ matrix_client_schildichat_theme_file_list.files }}"
- name: Load SchildiChat theme
2023-08-30 18:23:52 +02:00
ansible.builtin.set_fact:
matrix_client_schildichat_setting_defaults_custom_themes: "{{ matrix_client_schildichat_setting_defaults_custom_themes + [item['content'] | b64decode | from_json] }}" # noqa var-naming
with_items: "{{ matrix_client_schildichat_theme_file_contents.results }}"
#
# Tasks related to getting rid of SchildiChat themes (if it was previously enabled)
2023-08-30 18:23:52 +02:00
#
- name: Ensure SchildiChat themes repository is removed
2023-08-30 18:23:52 +02:00
ansible.builtin.file:
path: "{{ role_path }}/files/scratchpad/themes"
state: absent
run_once: true
delegate_to: 127.0.0.1
become: false
when: "not matrix_client_schildichat_themes_enabled | bool"