diff --git a/roles/jitsi/README.md b/roles/jitsi/README.md index bd3db9bb..57f5f8e6 100644 --- a/roles/jitsi/README.md +++ b/roles/jitsi/README.md @@ -16,6 +16,9 @@ coturn uses the certificate obtained by the web container and is restarted weekl It needs 3478/udp+tcp, 5349/tcp and the relay port range 49152-65535/udp to be reachable. The exporter scrapes the JVB statistics and listens on port 9888. +Files can be added to or replaced in the Jitsi Meet web root (`/usr/share/jitsi-meet` in the web container) using `jitsi__web_files`, e.g. for branding. +They are deployed to `/opt/jitsi/web-files/` and bind-mounted into the web container. + ## Supported Distributions Should work on Debian-based distributions. @@ -49,6 +52,10 @@ Should work on Debian-based distributions. Defaults to `""` (no file). - `jitsi__custom_interface_config_js`: Content of `custom-interface_config.js`, which gets appended to the generated `interface_config.js`. Defaults to `""` (no file). +- `jitsi__web_files`: List of files to mount into the Jitsi Meet web root. + Defaults to `[ ]`. +- `jitsi__web_files.*.path`: Path relative to the web root, e.g. `images/watermark.svg` or `static/welcomePageAdditionalContent.html`. +- `jitsi__web_files.*.content`: The content of the file. ## Links & Resources diff --git a/roles/jitsi/defaults/main.yaml b/roles/jitsi/defaults/main.yaml index 9782b636..5bed993e 100644 --- a/roles/jitsi/defaults/main.yaml +++ b/roles/jitsi/defaults/main.yaml @@ -6,3 +6,4 @@ jitsi__prometheus_exporter: false jitsi__env: { } jitsi__custom_config_js: "" jitsi__custom_interface_config_js: "" +jitsi__web_files: [ ] diff --git a/roles/jitsi/meta/argument_specs.yaml b/roles/jitsi/meta/argument_specs.yaml index 2c65ca54..36ee25b6 100644 --- a/roles/jitsi/meta/argument_specs.yaml +++ b/roles/jitsi/meta/argument_specs.yaml @@ -55,3 +55,15 @@ argument_specs: type: str required: false default: "" + jitsi__web_files: + type: list + elements: dict + required: false + default: [ ] + options: + path: + type: str + required: true + content: + type: str + required: true diff --git a/roles/jitsi/tasks/main.yaml b/roles/jitsi/tasks/main.yaml index a7beaaa4..92b9da83 100644 --- a/roles/jitsi/tasks/main.yaml +++ b/roles/jitsi/tasks/main.yaml @@ -140,6 +140,46 @@ state: "{{ 'present' if jitsi__turn else 'absent' }}" become: true +# Files mounted into the web container, replacing or adding to the files of Jitsi Meet. +- name: make sure the directories for the web files exist + ansible.builtin.file: + path: "{{ jitsi__base_dir }}/web-files/{{ item }}" + state: directory + mode: "0755" + owner: root + group: root + become: true + loop: "{{ [''] + (jitsi__web_files | map(attribute='path') | map('dirname') | unique | reject('equalto', '') | list) }}" + +- name: deploy the web files + ansible.builtin.copy: + content: "{{ item.content }}" + dest: "{{ jitsi__base_dir }}/web-files/{{ item.path }}" + mode: "0644" + owner: root + group: root + become: true + loop: "{{ jitsi__web_files }}" + loop_control: + label: "{{ item.path }}" + # Single file bind mounts keep pointing to the replaced file until the container is restarted. + notify: restart jitsi web + +- name: find web files to remove + ansible.builtin.find: + paths: "{{ jitsi__base_dir }}/web-files" + recurse: true + register: jitsi__web_files_found + +- name: remove web files, which should be removed + ansible.builtin.file: + path: "{{ item }}" + state: absent + become: true + loop: "{{ jitsi__web_files_found.files | map(attribute='path') | reject('in', jitsi__web_files_paths) | list }}" + vars: + jitsi__web_files_paths: "{{ jitsi__web_files | map(attribute='path') | map('regex_replace', '^', jitsi__base_dir ~ '/web-files/') | list }}" + # Changes to these make `docker compose up` below recreate the affected containers. - name: deploy the compose override file ansible.builtin.template: diff --git a/roles/jitsi/templates/compose.override.yaml.j2 b/roles/jitsi/templates/compose.override.yaml.j2 index 05842569..628b83bc 100644 --- a/roles/jitsi/templates/compose.override.yaml.j2 +++ b/roles/jitsi/templates/compose.override.yaml.j2 @@ -8,6 +8,13 @@ networks: enable_ipv6: true services: +{% if jitsi__web_files | length > 0 %} + web: + volumes: +{% for file in jitsi__web_files %} + - {{ jitsi__base_dir }}/web-files/{{ file.path }}:/usr/share/jitsi-meet/{{ file.path }}:ro +{% endfor %} +{% endif %} {% if jitsi__turn %} coturn: image: docker.io/coturn/coturn:4.18.0 @@ -35,6 +42,6 @@ services: networks: meet.jitsi: {% endif %} -{% if not (jitsi__turn or jitsi__prometheus_exporter) %} +{% if not (jitsi__web_files or jitsi__turn or jitsi__prometheus_exporter) %} {} {% endif %}