2024-09-25 14:53:48 +10:00
|
|
|
---
|
2024-09-26 15:17:15 +10:00
|
|
|
# roles/custom/matrix-element-call/tasks/install.yml
|
2024-09-25 14:53:48 +10:00
|
|
|
|
2024-09-26 06:51:36 +10:00
|
|
|
# Ensure Required Directories Exist
|
|
|
|
- name: Ensure matrix-element-call paths exist
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item.path }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0750
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
2024-09-30 11:05:11 +10:00
|
|
|
with_items:
|
2024-09-26 06:51:36 +10:00
|
|
|
- path: "{{ matrix_element_call_base_path }}"
|
2024-09-26 19:08:09 +10:00
|
|
|
- path: "{{ matrix_base_data_path }}/static-files/public/.well-known/element" # Directory for element.json
|
2024-09-25 14:53:48 +10:00
|
|
|
|
2024-09-26 06:51:36 +10:00
|
|
|
# Ensure Configuration Files are in Place
|
2024-09-26 15:17:15 +10:00
|
|
|
- name: Ensure Element Call config.json is in place
|
2024-09-26 06:51:36 +10:00
|
|
|
ansible.builtin.template:
|
2024-09-26 15:17:15 +10:00
|
|
|
src: "{{ role_path }}/templates/config.json.j2"
|
2024-09-30 22:35:59 +10:00
|
|
|
dest: "{{ matrix_element_call_base_path }}/config.json"
|
2024-09-26 06:51:36 +10:00
|
|
|
mode: 0640
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
2024-09-25 14:53:48 +10:00
|
|
|
|
2024-09-26 15:17:15 +10:00
|
|
|
- name: Ensure matrix-element-call Docker labels file is in place
|
|
|
|
ansible.builtin.template:
|
2024-09-27 09:00:03 +10:00
|
|
|
src: "{{ role_path }}/templates/element-call-labels.j2"
|
2024-09-30 22:35:59 +10:00
|
|
|
dest: "{{ matrix_element_call_base_path }}/element-call-labels"
|
2024-09-26 06:51:36 +10:00
|
|
|
mode: 0640
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
2024-09-25 14:53:48 +10:00
|
|
|
|
2024-09-26 06:51:36 +10:00
|
|
|
# Ensure Docker Images are Pulled
|
2024-09-26 15:17:15 +10:00
|
|
|
- name: Ensure matrix-element-call Docker image is pulled
|
2024-09-26 06:51:36 +10:00
|
|
|
community.docker.docker_image:
|
2024-09-26 15:17:15 +10:00
|
|
|
name: "{{ matrix_element_call_container_image }}"
|
2024-09-26 06:51:36 +10:00
|
|
|
source: pull
|
2024-09-26 15:17:15 +10:00
|
|
|
force_source: "{{ matrix_element_call_container_image_force_pull }}"
|
2024-09-26 06:51:36 +10:00
|
|
|
register: element_call_image_result
|
|
|
|
retries: "{{ devture_playbook_help_container_retries_count }}"
|
|
|
|
delay: "{{ devture_playbook_help_container_retries_delay }}"
|
|
|
|
until: element_call_image_result is not failed
|
|
|
|
|
2024-10-01 10:41:30 +10:00
|
|
|
# Systemd Services for Element Call
|
2024-09-26 06:51:36 +10:00
|
|
|
- name: Ensure matrix-element-call systemd service is installed
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ role_path }}/templates/systemd/matrix-element-call.service.j2"
|
|
|
|
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-element-call.service"
|
|
|
|
mode: 0644
|
|
|
|
|
2024-09-26 15:17:15 +10:00
|
|
|
# Update homeserver.yaml for Element Call
|
|
|
|
- name: Add listeners section for Element Call to homeserver.yaml
|
|
|
|
ansible.builtin.blockinfile:
|
|
|
|
path: "{{ matrix_homeserver_config_path }}"
|
|
|
|
block: |
|
|
|
|
listeners:
|
|
|
|
- port: 8008
|
|
|
|
tls: false
|
|
|
|
type: http
|
|
|
|
x_forwarded: true
|
|
|
|
resources:
|
|
|
|
- names: [client, federation, openid]
|
|
|
|
compress: false
|
|
|
|
marker: "# ANSIBLE MANAGED BLOCK - Element Call listeners"
|
|
|
|
mode: '0644'
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
when: matrix_element_call_enabled | bool
|
|
|
|
|
|
|
|
- name: Ensure serve_server_wellknown is enabled in homeserver.yaml
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: "{{ matrix_homeserver_config_path }}"
|
|
|
|
line: "serve_server_wellknown: true"
|
|
|
|
insertafter: EOF
|
|
|
|
state: present
|
|
|
|
mode: '0644'
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
when: matrix_element_call_enabled | bool
|
|
|
|
|
2024-09-26 18:50:48 +10:00
|
|
|
# Update the well-known client file for Element Call (adding RTC FOCI)
|
2024-10-01 22:20:50 +10:00
|
|
|
- name: Update the well-known client file for Element Call
|
2024-10-01 22:30:09 +10:00
|
|
|
ansible.builtin.include_tasks: "tasks/update_well_known_client.yml"
|
2024-10-01 22:20:50 +10:00
|
|
|
when: matrix_element_call_enabled | bool
|
|
|
|
|
2024-09-26 15:17:15 +10:00
|
|
|
|
|
|
|
# Create .well-known/element/element.json for Element Call
|
|
|
|
- name: Create the well-known element.json file
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ role_path }}/templates/well_known_element.json.j2"
|
|
|
|
dest: "{{ matrix_base_data_path }}/static-files/public/.well-known/element/element.json"
|
|
|
|
mode: '0644'
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
|
|
|
|
# Update Element Web config.json with Element Call settings
|
|
|
|
- name: Update Element Web config.json
|
2024-10-01 22:20:50 +10:00
|
|
|
ansible.builtin.include_tasks: "tasks/update_element_web_config.yml"
|
2024-10-03 12:38:34 +10:00
|
|
|
when: matrix_element_call_enabled | bool
|