Replace most import_tasks calls with include_tasks for improved performance
This commit is contained in:
		| @@ -1,43 +1,50 @@ | ||||
| --- | ||||
|  | ||||
| - ansible.builtin.import_tasks: "{{ role_path }}/tasks/init_additional_jvb.yml" | ||||
| - block: | ||||
|     - when: matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/init_additional_jvb.yml" | ||||
|   tags: | ||||
|     - setup-additional-jitsi-jvb | ||||
|  | ||||
| - ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" | ||||
|   when: "run_setup | bool and matrix_jitsi_enabled | bool" | ||||
| - block: | ||||
|     - when: matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" | ||||
|  | ||||
|     - when: matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_base.yml" | ||||
|   tags: | ||||
|     - setup-all | ||||
|     - setup-jitsi | ||||
|     - setup-additional-jitsi-jvb | ||||
|  | ||||
| - ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_base.yml" | ||||
|   when: run_setup | bool | ||||
|   tags: | ||||
|     - setup-all | ||||
|     - setup-jitsi | ||||
|     - setup-additional-jitsi-jvb | ||||
|  | ||||
| - ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_web.yml" | ||||
|   when: run_setup | bool | ||||
|   tags: | ||||
|     - setup-all | ||||
|     - setup-jitsi | ||||
|  | ||||
| - ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_prosody.yml" | ||||
|   when: run_setup | bool | ||||
|   tags: | ||||
|     - setup-all | ||||
|     - setup-jitsi | ||||
|  | ||||
| - ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_jicofo.yml" | ||||
|   when: run_setup | bool | ||||
|   tags: | ||||
|     - setup-all | ||||
|     - setup-jitsi | ||||
|  | ||||
| - ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_jvb.yml" | ||||
|   when: run_setup | bool | ||||
| - block: | ||||
|     - when: matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_web_install.yml" | ||||
|  | ||||
|     - when: not matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_web_uninstall.yml" | ||||
|  | ||||
|     - when: matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_prosody_install.yml" | ||||
|  | ||||
|     - when: not matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_prosody_uninstall.yml" | ||||
|  | ||||
|     - when: matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_jicofo_install.yml" | ||||
|  | ||||
|     - when: not matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_jicofo_uninstall.yml" | ||||
|   tags: | ||||
|     - setup-all | ||||
|     - setup-jitsi | ||||
|  | ||||
| - block: | ||||
|     - when: matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_jvb_install.yml" | ||||
|  | ||||
|     - when: not matrix_jitsi_enabled | bool | ||||
|       ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_jitsi_jvb_uninstall.yml" | ||||
|   tags: | ||||
|     - setup-all | ||||
|     - setup-jitsi | ||||
|   | ||||
| @@ -4,10 +4,6 @@ | ||||
|     name: custom/matrix-base | ||||
|     tasks_from: ensure_openssl_installed | ||||
|  | ||||
| # | ||||
| # Tasks related to setting up jitsi | ||||
| # | ||||
|  | ||||
| - name: Ensure Matrix jitsi base path exists | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ item.path }}" | ||||
| @@ -17,8 +13,4 @@ | ||||
|     group: "{{ matrix_user_groupname }}" | ||||
|   with_items: | ||||
|     - {path: "{{ matrix_jitsi_base_path }}", when: true} | ||||
|   when: matrix_jitsi_enabled | bool and item.when | ||||
|  | ||||
| # | ||||
| # Tasks related to getting rid of jitsi (if it was previously enabled) | ||||
| # | ||||
|   when: item.when | bool | ||||
|   | ||||
| @@ -1,9 +1,5 @@ | ||||
| --- | ||||
| 
 | ||||
| # | ||||
| # Tasks related to setting up jitsi-jicofo | ||||
| # | ||||
| 
 | ||||
| - name: Ensure Matrix jitsi-jicofo path exists | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ item.path }}" | ||||
| @@ -14,7 +10,7 @@ | ||||
|   with_items: | ||||
|     - {path: "{{ matrix_jitsi_jicofo_base_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_jicofo_config_path }}", when: true} | ||||
|   when: matrix_jitsi_enabled | bool and item.when | ||||
|   when: item.when | bool | ||||
| 
 | ||||
| - name: Ensure jitsi-jicofo Docker image is pulled | ||||
|   community.docker.docker_image: | ||||
| @@ -22,7 +18,6 @@ | ||||
|     source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | ||||
|     force_source: "{{ matrix_jitsi_jicofo_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | ||||
|     force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_jitsi_jicofo_docker_image_force_pull }}" | ||||
|   when: matrix_jitsi_enabled | bool | ||||
|   register: result | ||||
|   retries: "{{ devture_playbook_help_container_retries_count }}" | ||||
|   delay: "{{ devture_playbook_help_container_retries_delay }}" | ||||
| @@ -47,7 +42,6 @@ | ||||
|   with_items: | ||||
|     - sip-communicator.properties | ||||
|     - logging.properties | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-jicofo.service installed | ||||
|   ansible.builtin.template: | ||||
| @@ -55,48 +49,3 @@ | ||||
|     dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jicofo.service" | ||||
|     mode: 0644 | ||||
|   register: matrix_jitsi_jicofo_systemd_service_result | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service installation | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "matrix_jitsi_enabled and matrix_jitsi_jicofo_systemd_service_result.changed" | ||||
| 
 | ||||
| # | ||||
| # Tasks related to getting rid of jitsi-jicofo (if it was previously enabled) | ||||
| # | ||||
| 
 | ||||
| - name: Check existence of matrix-jitsi-jicofo service | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jicofo.service" | ||||
|   register: matrix_jitsi_jicofo_service_stat | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-jicofo is stopped | ||||
|   ansible.builtin.service: | ||||
|     name: matrix-jitsi-jicofo | ||||
|     state: stopped | ||||
|     enabled: false | ||||
|     daemon_reload: true | ||||
|   register: stopping_result | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jicofo_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-jicofo.service doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jicofo.service" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jicofo_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service removal | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jicofo_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure Matrix jitsi-jicofo paths doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ matrix_jitsi_jicofo_base_path }}" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
| 
 | ||||
| # Intentionally not removing the Docker image when uninstalling. | ||||
| # We can't be sure it had been pulled by us in the first place. | ||||
| @@ -0,0 +1,26 @@ | ||||
| --- | ||||
|  | ||||
| - name: Check existence of matrix-jitsi-jicofo service | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jicofo.service" | ||||
|   register: matrix_jitsi_jicofo_service_stat | ||||
|  | ||||
| - when: matrix_jitsi_jicofo_service_stat.stat.exists | bool | ||||
|   block: | ||||
|     - name: Ensure matrix-jitsi-jicofo is stopped | ||||
|       ansible.builtin.service: | ||||
|         name: matrix-jitsi-jicofo | ||||
|         state: stopped | ||||
|         enabled: false | ||||
|         daemon_reload: true | ||||
|       register: stopping_result | ||||
|  | ||||
|     - name: Ensure matrix-jitsi-jicofo.service doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jicofo.service" | ||||
|         state: absent | ||||
|  | ||||
|     - name: Ensure Matrix jitsi-jicofo paths doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ matrix_jitsi_jicofo_base_path }}" | ||||
|         state: absent | ||||
| @@ -1,9 +1,5 @@ | ||||
| --- | ||||
| 
 | ||||
| # | ||||
| # Tasks related to setting up jitsi-jvb | ||||
| # | ||||
| 
 | ||||
| - name: Ensure Matrix jitsi-jvb path exists | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ item.path }}" | ||||
| @@ -14,7 +10,7 @@ | ||||
|   with_items: | ||||
|     - {path: "{{ matrix_jitsi_jvb_base_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_jvb_config_path }}", when: true} | ||||
|   when: matrix_jitsi_enabled | bool and item.when | ||||
|   when: item.when | bool | ||||
| 
 | ||||
| - name: Ensure jitsi-jvb Docker image is pulled | ||||
|   community.docker.docker_image: | ||||
| @@ -22,7 +18,6 @@ | ||||
|     source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | ||||
|     force_source: "{{ matrix_jitsi_jvb_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | ||||
|     force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_jitsi_jvb_docker_image_force_pull }}" | ||||
|   when: matrix_jitsi_enabled | bool | ||||
|   register: result | ||||
|   retries: "{{ devture_playbook_help_container_retries_count }}" | ||||
|   delay: "{{ devture_playbook_help_container_retries_delay }}" | ||||
| @@ -38,7 +33,6 @@ | ||||
|   with_items: | ||||
|     - custom-sip-communicator.properties | ||||
|     - logging.properties | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure jitsi-jvb environment variables file created | ||||
|   ansible.builtin.template: | ||||
| @@ -47,56 +41,9 @@ | ||||
|     owner: "{{ matrix_user_username }}" | ||||
|     group: "{{ matrix_user_groupname }}" | ||||
|     mode: 0640 | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-jvb.service installed | ||||
|   ansible.builtin.template: | ||||
|     src: "{{ role_path }}/templates/jvb/matrix-jitsi-jvb.service.j2" | ||||
|     dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jvb.service" | ||||
|     mode: 0644 | ||||
|   register: matrix_jitsi_jvb_systemd_service_result | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure systemd reloaded after matrix-jitsi-jvb.service installation | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "matrix_jitsi_enabled and matrix_jitsi_jvb_systemd_service_result.changed" | ||||
| 
 | ||||
| # | ||||
| # Tasks related to getting rid of jitsi-jvb (if it was previously enabled) | ||||
| # | ||||
| 
 | ||||
| - name: Check existence of matrix-jitsi-jvb service | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jvb.service" | ||||
|   register: matrix_jitsi_jvb_service_stat | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-jvb is stopped | ||||
|   ansible.builtin.service: | ||||
|     name: matrix-jitsi-jvb | ||||
|     state: stopped | ||||
|     enabled: false | ||||
|     daemon_reload: true | ||||
|   register: stopping_result | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jvb_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-jvb.service doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jvb.service" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jvb_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure systemd reloaded after matrix-jitsi-jvb.service removal | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jvb_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure Matrix jitsi-jvb paths doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ matrix_jitsi_jvb_base_path }}" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
| 
 | ||||
| # Intentionally not removing the Docker image when uninstalling. | ||||
| # We can't be sure it had been pulled by us in the first place. | ||||
| @@ -0,0 +1,26 @@ | ||||
| --- | ||||
|  | ||||
| - name: Check existence of matrix-jitsi-jvb service | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jvb.service" | ||||
|   register: matrix_jitsi_jvb_service_stat | ||||
|  | ||||
| - when: matrix_jitsi_jvb_service_stat.stat.exists | bool | ||||
|   block: | ||||
|     - name: Ensure matrix-jitsi-jvb is stopped | ||||
|       ansible.builtin.service: | ||||
|         name: matrix-jitsi-jvb | ||||
|         state: stopped | ||||
|         enabled: false | ||||
|         daemon_reload: true | ||||
|       register: stopping_result | ||||
|  | ||||
|     - name: Ensure matrix-jitsi-jvb.service doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-jvb.service" | ||||
|         state: absent | ||||
|  | ||||
|     - name: Ensure Matrix jitsi-jvb paths doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ matrix_jitsi_jvb_base_path }}" | ||||
|         state: absent | ||||
| @@ -1,99 +0,0 @@ | ||||
| --- | ||||
|  | ||||
| # | ||||
| # Tasks related to setting up jitsi-prosody | ||||
| # | ||||
|  | ||||
| - name: Ensure Matrix jitsi-prosody environment exists | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ item.path }}" | ||||
|     state: directory | ||||
|     mode: 0777 | ||||
|     owner: "{{ matrix_user_username }}" | ||||
|     group: "{{ matrix_user_groupname }}" | ||||
|   with_items: | ||||
|     - {path: "{{ matrix_jitsi_prosody_base_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_prosody_config_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_prosody_plugins_path }}", when: true} | ||||
|   when: matrix_jitsi_enabled | bool and item.when | ||||
|  | ||||
| - name: Ensure jitsi-prosody Docker image is pulled | ||||
|   community.docker.docker_image: | ||||
|     name: "{{ matrix_jitsi_prosody_docker_image }}" | ||||
|     source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | ||||
|     force_source: "{{ matrix_jitsi_prosody_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | ||||
|     force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_jitsi_prosody_docker_image_force_pull }}" | ||||
|   when: matrix_jitsi_enabled | bool | ||||
|   register: result | ||||
|   retries: "{{ devture_playbook_help_container_retries_count }}" | ||||
|   delay: "{{ devture_playbook_help_container_retries_delay }}" | ||||
|   until: result is not failed | ||||
|  | ||||
| - name: Ensure jitsi-prosody environment variables file is created | ||||
|   ansible.builtin.template: | ||||
|     src: "{{ role_path }}/templates/prosody/env.j2" | ||||
|     dest: "{{ matrix_jitsi_prosody_base_path }}/env" | ||||
|     owner: "{{ matrix_user_username }}" | ||||
|     group: "{{ matrix_user_groupname }}" | ||||
|     mode: 0640 | ||||
|   when: matrix_jitsi_enabled | bool | ||||
|  | ||||
| - name: Ensure matrix-jitsi-prosody.service file is installed | ||||
|   ansible.builtin.template: | ||||
|     src: "{{ role_path }}/templates/prosody/matrix-jitsi-prosody.service.j2" | ||||
|     dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-prosody.service" | ||||
|     mode: 0644 | ||||
|   register: matrix_jitsi_prosody_systemd_service_result | ||||
|   when: matrix_jitsi_enabled | bool | ||||
|  | ||||
| - name: Ensure systemd service is reloaded after matrix-jitsi-prosody.service installation | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "matrix_jitsi_enabled and matrix_jitsi_prosody_systemd_service_result.changed" | ||||
|  | ||||
| - name: Ensure authentication is properly configured | ||||
|   ansible.builtin.include_tasks: | ||||
|     file: "{{ role_path }}/tasks/util/setup_jitsi_auth.yml" | ||||
|   when: | ||||
|     - matrix_jitsi_enabled | bool | ||||
|     - matrix_jitsi_enable_auth | bool | ||||
|  | ||||
|  | ||||
| # | ||||
| # Tasks related to getting rid of jitsi-prosody (if it was previously enabled) | ||||
| # | ||||
|  | ||||
| - name: Ensure matrix-jitsi-prosody.service file exists | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-prosody.service" | ||||
|   register: matrix_jitsi_prosody_service_stat | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
|  | ||||
| - name: Ensure matrix-jitsi-prosody is stopped | ||||
|   ansible.builtin.service: | ||||
|     name: matrix-jitsi-prosody | ||||
|     state: stopped | ||||
|     enabled: false | ||||
|     daemon_reload: true | ||||
|   register: stopping_result | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_prosody_service_stat.stat.exists" | ||||
|  | ||||
| - name: Ensure matrix-jitsi-prosody.service file doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-prosody.service" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_prosody_service_stat.stat.exists" | ||||
|  | ||||
| - name: Ensure systemd is reloaded after matrix-jitsi-prosody.service removal | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_prosody_service_stat.stat.exists" | ||||
|  | ||||
| - name: Ensure Matrix jitsi-prosody paths doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ matrix_jitsi_prosody_base_path }}" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
|  | ||||
| # Intentionally not removing the Docker image when uninstalling. | ||||
| # We can't be sure it had been pulled by us in the first place. | ||||
| @@ -0,0 +1,45 @@ | ||||
| --- | ||||
|  | ||||
| - name: Ensure Matrix jitsi-prosody environment exists | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ item.path }}" | ||||
|     state: directory | ||||
|     mode: 0777 | ||||
|     owner: "{{ matrix_user_username }}" | ||||
|     group: "{{ matrix_user_groupname }}" | ||||
|   with_items: | ||||
|     - {path: "{{ matrix_jitsi_prosody_base_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_prosody_config_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_prosody_plugins_path }}", when: true} | ||||
|   when: item.when | bool | ||||
|  | ||||
| - name: Ensure jitsi-prosody Docker image is pulled | ||||
|   community.docker.docker_image: | ||||
|     name: "{{ matrix_jitsi_prosody_docker_image }}" | ||||
|     source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | ||||
|     force_source: "{{ matrix_jitsi_prosody_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | ||||
|     force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_jitsi_prosody_docker_image_force_pull }}" | ||||
|   register: result | ||||
|   retries: "{{ devture_playbook_help_container_retries_count }}" | ||||
|   delay: "{{ devture_playbook_help_container_retries_delay }}" | ||||
|   until: result is not failed | ||||
|  | ||||
| - name: Ensure jitsi-prosody environment variables file is created | ||||
|   ansible.builtin.template: | ||||
|     src: "{{ role_path }}/templates/prosody/env.j2" | ||||
|     dest: "{{ matrix_jitsi_prosody_base_path }}/env" | ||||
|     owner: "{{ matrix_user_username }}" | ||||
|     group: "{{ matrix_user_groupname }}" | ||||
|     mode: 0640 | ||||
|  | ||||
| - name: Ensure matrix-jitsi-prosody.service file is installed | ||||
|   ansible.builtin.template: | ||||
|     src: "{{ role_path }}/templates/prosody/matrix-jitsi-prosody.service.j2" | ||||
|     dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-prosody.service" | ||||
|     mode: 0644 | ||||
|   register: matrix_jitsi_prosody_systemd_service_result | ||||
|  | ||||
| - name: Ensure authentication is properly configured | ||||
|   ansible.builtin.include_tasks: | ||||
|     file: "{{ role_path }}/tasks/util/setup_jitsi_auth.yml" | ||||
|   when: matrix_jitsi_enable_auth | bool | ||||
| @@ -0,0 +1,26 @@ | ||||
| --- | ||||
|  | ||||
| - name: Check if matrix-jitsi-prosody.service file exists | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-prosody.service" | ||||
|   register: matrix_jitsi_prosody_service_stat | ||||
|  | ||||
| - when: matrix_jitsi_prosody_service_stat.stat.exists | bool | ||||
|   block: | ||||
|     - name: Ensure matrix-jitsi-prosody is stopped | ||||
|       ansible.builtin.service: | ||||
|         name: matrix-jitsi-prosody | ||||
|         state: stopped | ||||
|         enabled: false | ||||
|         daemon_reload: true | ||||
|       register: stopping_result | ||||
|  | ||||
|     - name: Ensure matrix-jitsi-prosody.service file doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-prosody.service" | ||||
|         state: absent | ||||
|  | ||||
|     - name: Ensure Matrix jitsi-prosody paths doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ matrix_jitsi_prosody_base_path }}" | ||||
|         state: absent | ||||
| @@ -1,9 +1,5 @@ | ||||
| --- | ||||
| 
 | ||||
| # | ||||
| # Tasks related to setting up jitsi-web | ||||
| # | ||||
| 
 | ||||
| - name: Ensure Matrix jitsi-web path exists | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ item.path }}" | ||||
| @@ -16,7 +12,7 @@ | ||||
|     - {path: "{{ matrix_jitsi_web_config_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_web_transcripts_path }}", when: true} | ||||
|     - {path: "{{ matrix_jitsi_web_crontabs_path }}", when: true} | ||||
|   when: matrix_jitsi_enabled | bool and item.when | ||||
|   when: item.when | bool | ||||
| 
 | ||||
| - name: Ensure jitsi-web Docker image is pulled | ||||
|   community.docker.docker_image: | ||||
| @@ -24,7 +20,6 @@ | ||||
|     source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | ||||
|     force_source: "{{ matrix_jitsi_web_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | ||||
|     force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_jitsi_web_docker_image_force_pull }}" | ||||
|   when: matrix_jitsi_enabled | bool | ||||
|   register: result | ||||
|   retries: "{{ devture_playbook_help_container_retries_count }}" | ||||
|   delay: "{{ devture_playbook_help_container_retries_delay }}" | ||||
| @@ -37,7 +32,6 @@ | ||||
|     owner: "{{ matrix_user_username }}" | ||||
|     group: "{{ matrix_user_groupname }}" | ||||
|     mode: 0640 | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure jitsi-web configuration files created | ||||
|   ansible.builtin.template: | ||||
| @@ -49,7 +43,6 @@ | ||||
|   with_items: | ||||
|     - custom-config.js | ||||
|     - custom-interface_config.js | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-web.service installed | ||||
|   ansible.builtin.template: | ||||
| @@ -57,48 +50,3 @@ | ||||
|     dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-web.service" | ||||
|     mode: 0644 | ||||
|   register: matrix_jitsi_web_systemd_service_result | ||||
|   when: matrix_jitsi_enabled | bool | ||||
| 
 | ||||
| - name: Ensure systemd reloaded after matrix-jitsi-web.service installation | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "matrix_jitsi_enabled and matrix_jitsi_web_systemd_service_result.changed" | ||||
| 
 | ||||
| # | ||||
| # Tasks related to getting rid of jitsi-web (if it was previously enabled) | ||||
| # | ||||
| 
 | ||||
| - name: Check existence of matrix-jitsi-web service | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-web.service" | ||||
|   register: matrix_jitsi_web_service_stat | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-web is stopped | ||||
|   ansible.builtin.service: | ||||
|     name: matrix-jitsi-web | ||||
|     state: stopped | ||||
|     enabled: false | ||||
|     daemon_reload: true | ||||
|   register: stopping_result | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_web_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure matrix-jitsi-web.service doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-web.service" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_web_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure systemd reloaded after matrix-jitsi-web.service removal | ||||
|   ansible.builtin.service: | ||||
|     daemon_reload: true | ||||
|   when: "not matrix_jitsi_enabled | bool and matrix_jitsi_web_service_stat.stat.exists" | ||||
| 
 | ||||
| - name: Ensure Matrix jitsi-web paths doesn't exist | ||||
|   ansible.builtin.file: | ||||
|     path: "{{ matrix_jitsi_web_base_path }}" | ||||
|     state: absent | ||||
|   when: "not matrix_jitsi_enabled | bool" | ||||
| 
 | ||||
| # Intentionally not removing the Docker image when uninstalling. | ||||
| # We can't be sure it had been pulled by us in the first place. | ||||
| @@ -0,0 +1,26 @@ | ||||
| --- | ||||
|  | ||||
| - name: Check existence of matrix-jitsi-web service | ||||
|   ansible.builtin.stat: | ||||
|     path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-web.service" | ||||
|   register: matrix_jitsi_web_service_stat | ||||
|  | ||||
| - when: matrix_jitsi_web_service_stat.stat.exists | bool | ||||
|   block: | ||||
|     - name: Ensure matrix-jitsi-web is stopped | ||||
|       ansible.builtin.service: | ||||
|         name: matrix-jitsi-web | ||||
|         state: stopped | ||||
|         enabled: false | ||||
|         daemon_reload: true | ||||
|       register: stopping_result | ||||
|  | ||||
|     - name: Ensure matrix-jitsi-web.service doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jitsi-web.service" | ||||
|         state: absent | ||||
|  | ||||
|     - name: Ensure Matrix jitsi-web paths doesn't exist | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ matrix_jitsi_web_base_path }}" | ||||
|         state: absent | ||||
		Reference in New Issue
	
	Block a user