Relocate /.well-known/element/element.json setup to matrix-static-files, instead of ugly patching from the Element Call role

This commit is contained in:
Slavi Pantaleev
2024-11-21 19:32:15 +02:00
parent 3f52cec25c
commit 252ca52f60
6 changed files with 83 additions and 23 deletions

View File

@ -2,17 +2,19 @@
- name: Ensure matrix-static-files paths exist
ansible.builtin.file:
path: "{{ item }}"
path: "{{ item.path }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- "{{ matrix_static_files_base_path }}"
- "{{ matrix_static_files_config_path }}"
- "{{ matrix_static_files_public_path }}"
- "{{ matrix_static_files_public_well_known_path }}"
- "{{ matrix_static_files_public_well_known_matrix_path }}"
- {path: "{{ matrix_static_files_base_path }}", when: true}
- {path: "{{ matrix_static_files_config_path }}", when: true}
- {path: "{{ matrix_static_files_public_path }}", when: true}
- {path: "{{ matrix_static_files_public_well_known_path }}", when: true}
- {path: "{{ matrix_static_files_public_well_known_matrix_path }}", when: true}
- {path: "{{ matrix_static_files_public_well_known_element_path }}", when: true}
when: "item.when | bool"
- name: Ensure matrix-static-files is configured
ansible.builtin.template:
@ -52,6 +54,10 @@
dest: "{{ matrix_static_files_public_well_known_matrix_path }}/support"
when: "{{ matrix_static_files_file_matrix_support_enabled }}"
- content: "{{ matrix_static_files_file_element_element_json_configuration | to_nice_json }}"
dest: "{{ matrix_static_files_public_well_known_element_path }}/element.json"
when: "{{ matrix_static_files_file_element_element_json_enabled }}"
# This one will not be deleted if `matrix_static_files_file_index_html_enabled` flips to `false`.
# See the comment for `matrix_static_files_file_index_html_enabled` to learn why.
- content: "{{ matrix_static_files_file_index_html_template }}"
@ -70,6 +76,12 @@
state: absent
when: "not matrix_static_files_file_matrix_support_enabled | bool"
- name: Ensure /.well-known/element/element.json file deleted if not enabled
ansible.builtin.file:
path: "{{ matrix_static_files_public_well_known_element_path }}/element.json"
state: absent
when: "not matrix_static_files_file_element_element_json_enabled | bool"
- name: Ensure matrix-static-files container image is pulled
community.docker.docker_image:
name: "{{ matrix_static_files_container_image }}"