From d29b0aeddb0b5fdc0f2ed5927bd12411b33df262 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 24 Nov 2022 15:19:42 +0200 Subject: [PATCH] Replace even more import_tasks calls with include_tasks --- roles/custom/matrix-base/tasks/main.yml | 15 ++-- .../tasks/setup_install.yml | 2 +- .../tasks/setup_install.yml | 2 +- .../matrix-dendrite/tasks/dendrite/setup.yml | 7 -- .../tasks/dendrite/setup_uninstall.yml | 30 ------- roles/custom/matrix-dendrite/tasks/main.yml | 5 +- .../matrix-dendrite/tasks/setup_dendrite.yml | 15 ---- .../tasks/{dendrite => }/setup_install.yml | 19 +++-- .../matrix-dendrite/tasks/setup_uninstall.yml | 25 ++++++ .../matrix-ma1sd/tasks/migrate_mxisd.yml | 80 ------------------- .../matrix-ma1sd/tasks/setup_install.yml | 3 - .../tasks/ext/encryption-disabler/setup.yml | 7 -- .../{setup.yml => setup_install.yml} | 1 - .../tasks/ext/mjolnir-antispam/setup.yml | 7 -- .../tasks/ext/rest-auth/setup.yml | 7 -- .../tasks/ext/s3-storage-provider/setup.yml | 10 --- .../custom/matrix-synapse/tasks/ext/setup.yml | 77 ++++++++++++++++-- .../tasks/ext/shared-secret-auth/setup.yml | 7 -- .../ext/synapse-simple-antispam/setup.yml | 7 -- .../matrix-synapse/tasks/goofys/setup.yml | 12 ++- roles/custom/matrix-synapse/tasks/main.yml | 7 +- 21 files changed, 132 insertions(+), 213 deletions(-) delete mode 100644 roles/custom/matrix-dendrite/tasks/dendrite/setup.yml delete mode 100644 roles/custom/matrix-dendrite/tasks/dendrite/setup_uninstall.yml delete mode 100644 roles/custom/matrix-dendrite/tasks/setup_dendrite.yml rename roles/custom/matrix-dendrite/tasks/{dendrite => }/setup_install.yml (90%) create mode 100644 roles/custom/matrix-dendrite/tasks/setup_uninstall.yml delete mode 100644 roles/custom/matrix-ma1sd/tasks/migrate_mxisd.yml delete mode 100644 roles/custom/matrix-synapse/tasks/ext/encryption-disabler/setup.yml rename roles/custom/matrix-synapse/tasks/ext/ldap-auth/{setup.yml => setup_install.yml} (79%) delete mode 100644 roles/custom/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml delete mode 100644 roles/custom/matrix-synapse/tasks/ext/rest-auth/setup.yml delete mode 100644 roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/setup.yml delete mode 100644 roles/custom/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml delete mode 100644 roles/custom/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml diff --git a/roles/custom/matrix-base/tasks/main.yml b/roles/custom/matrix-base/tasks/main.yml index 97f0381d1..7eeb2cdc5 100644 --- a/roles/custom/matrix-base/tasks/main.yml +++ b/roles/custom/matrix-base/tasks/main.yml @@ -1,26 +1,27 @@ --- -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" +- block: + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" tags: - setup-all # This needs to always run, because it populates `matrix_user_uid` and `matrix_user_gid`, # which are required by many other roles. -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_matrix_user.yml" - when: run_setup | bool +- block: + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_matrix_user.yml" tags: - always - setup-system-user - common -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml" - when: run_setup | bool +- block: + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml" tags: - setup-all - common -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_well_known.yml" - when: run_setup | bool +- block: + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_well_known.yml" tags: - setup-all - setup-ma1sd diff --git a/roles/custom/matrix-bridge-appservice-irc/tasks/setup_install.yml b/roles/custom/matrix-bridge-appservice-irc/tasks/setup_install.yml index 32d87408d..7b58f81ec 100644 --- a/roles/custom/matrix-bridge-appservice-irc/tasks/setup_install.yml +++ b/roles/custom/matrix-bridge-appservice-irc/tasks/setup_install.yml @@ -60,7 +60,7 @@ - when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists | bool" block: - - ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - ansible.builtin.set_fact: matrix_appservice_irc_requires_restart: true diff --git a/roles/custom/matrix-bridge-appservice-slack/tasks/setup_install.yml b/roles/custom/matrix-bridge-appservice-slack/tasks/setup_install.yml index 2c7140851..f1751012c 100644 --- a/roles/custom/matrix-bridge-appservice-slack/tasks/setup_install.yml +++ b/roles/custom/matrix-bridge-appservice-slack/tasks/setup_install.yml @@ -26,7 +26,7 @@ - when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists | bool" block: - - ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - ansible.builtin.set_fact: matrix_appservice_slack_requires_restart: true diff --git a/roles/custom/matrix-dendrite/tasks/dendrite/setup.yml b/roles/custom/matrix-dendrite/tasks/dendrite/setup.yml deleted file mode 100644 index 1a8497294..000000000 --- a/roles/custom/matrix-dendrite/tasks/dendrite/setup.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/dendrite/setup_install.yml" - when: matrix_dendrite_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/dendrite/setup_uninstall.yml" - when: "not matrix_dendrite_enabled | bool" diff --git a/roles/custom/matrix-dendrite/tasks/dendrite/setup_uninstall.yml b/roles/custom/matrix-dendrite/tasks/dendrite/setup_uninstall.yml deleted file mode 100644 index ce3e34769..000000000 --- a/roles/custom/matrix-dendrite/tasks/dendrite/setup_uninstall.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- - -- name: Check existence of matrix-dendrite service - ansible.builtin.stat: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" - register: matrix_dendrite_service_stat - -- name: Ensure matrix-dendrite is stopped - ansible.builtin.service: - name: matrix-dendrite - state: stopped - daemon_reload: true - register: stopping_result - when: "matrix_dendrite_service_stat.stat.exists" - -- name: Ensure matrix-dendrite.service doesn't exist - ansible.builtin.file: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" - state: absent - when: "matrix_dendrite_service_stat.stat.exists" - -- name: Ensure systemd reloaded after matrix-dendrite.service removal - ansible.builtin.service: - daemon_reload: true - when: "matrix_dendrite_service_stat.stat.exists" - -- name: Ensure Dendrite Docker image doesn't exist - community.docker.docker_image: - name: "{{ matrix_dendrite_docker_image }}" - state: absent diff --git a/roles/custom/matrix-dendrite/tasks/main.yml b/roles/custom/matrix-dendrite/tasks/main.yml index 62057ded2..b59d3cadb 100644 --- a/roles/custom/matrix-dendrite/tasks/main.yml +++ b/roles/custom/matrix-dendrite/tasks/main.yml @@ -5,7 +5,10 @@ ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" - when: matrix_dendrite_enabled | bool - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_dendrite.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml" + + - when: not matrix_dendrite_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" tags: - setup-all - setup-dendrite diff --git a/roles/custom/matrix-dendrite/tasks/setup_dendrite.yml b/roles/custom/matrix-dendrite/tasks/setup_dendrite.yml deleted file mode 100644 index f74f08c2d..000000000 --- a/roles/custom/matrix-dendrite/tasks/setup_dendrite.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Ensure Dendrite paths exist - ansible.builtin.file: - path: "{{ item.path }}" - state: directory - mode: 0750 - owner: "{{ matrix_user_username }}" - group: "{{ matrix_user_groupname }}" - with_items: - - {path: "{{ matrix_dendrite_config_dir_path }}", when: true} - - {path: "{{ matrix_dendrite_ext_path }}", when: true} - - {path: "{{ matrix_dendrite_nats_storage_path }}", when: true} - when: "matrix_dendrite_enabled | bool and item.when" - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/dendrite/setup.yml" diff --git a/roles/custom/matrix-dendrite/tasks/dendrite/setup_install.yml b/roles/custom/matrix-dendrite/tasks/setup_install.yml similarity index 90% rename from roles/custom/matrix-dendrite/tasks/dendrite/setup_install.yml rename to roles/custom/matrix-dendrite/tasks/setup_install.yml index aec7f77b4..1c557e7f7 100644 --- a/roles/custom/matrix-dendrite/tasks/dendrite/setup_install.yml +++ b/roles/custom/matrix-dendrite/tasks/setup_install.yml @@ -1,4 +1,17 @@ --- + +- name: Ensure Dendrite paths exist + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: 0750 + owner: "{{ matrix_user_username }}" + group: "{{ matrix_user_groupname }}" + with_items: + - "{{ matrix_dendrite_config_dir_path }}" + - "{{ matrix_dendrite_ext_path }}" + - "{{ matrix_dendrite_nats_storage_path }}" + # This will throw a Permission Denied error if already mounted using fuse - name: Check Dendrite media store path ansible.builtin.stat: @@ -67,12 +80,6 @@ src: "{{ role_path }}/templates/dendrite/systemd/matrix-dendrite.service.j2" dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" mode: 0644 - register: matrix_dendrite_systemd_service_result - -- name: Ensure systemd reloaded after matrix-dendrite.service installation - ansible.builtin.service: - daemon_reload: true - when: "matrix_dendrite_systemd_service_result.changed | bool" - name: Ensure matrix-dendrite-create-account script created ansible.builtin.template: diff --git a/roles/custom/matrix-dendrite/tasks/setup_uninstall.yml b/roles/custom/matrix-dendrite/tasks/setup_uninstall.yml new file mode 100644 index 000000000..e37b219c3 --- /dev/null +++ b/roles/custom/matrix-dendrite/tasks/setup_uninstall.yml @@ -0,0 +1,25 @@ +--- + +- name: Check existence of matrix-dendrite service + ansible.builtin.stat: + path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" + register: matrix_dendrite_service_stat + +- when: matrix_dendrite_service_stat.stat.exists | bool + block: + - name: Ensure matrix-dendrite is stopped + ansible.builtin.service: + name: matrix-dendrite + state: stopped + daemon_reload: true + register: stopping_result + + - name: Ensure matrix-dendrite.service doesn't exist + ansible.builtin.file: + path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" + state: absent + + - name: Ensure Dendrite Docker image doesn't exist + community.docker.docker_image: + name: "{{ matrix_dendrite_docker_image }}" + state: absent diff --git a/roles/custom/matrix-ma1sd/tasks/migrate_mxisd.yml b/roles/custom/matrix-ma1sd/tasks/migrate_mxisd.yml deleted file mode 100644 index ee7228959..000000000 --- a/roles/custom/matrix-ma1sd/tasks/migrate_mxisd.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- - -# This task is for migrating existing mxisd data when transitioning to the ma1sd fork. - -- name: Check for existent mxisd data - ansible.builtin.stat: - path: "{{ matrix_base_data_path }}/mxisd/data" - register: ma1sd_migrate_mxisd_data_dir_stat - -- name: Warn if mxisd data detected - ansible.builtin.debug: - msg: > - You seem to have an existing mxisd folder in `{{ matrix_base_data_path }}/mxisd`. - We are going to migrate it to ma1sd and rename the folder to mxisd.migrated. - when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists" - -- name: Check existence of old matrix-mxisd service - ansible.builtin.stat: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-mxisd.service" - register: matrix_mxisd_service_stat - -- name: Ensure matrix-mxisd is stopped - ansible.builtin.service: - name: matrix-mxisd - state: stopped - enabled: false - daemon_reload: true - when: "matrix_mxisd_service_stat.stat.exists" - -- name: Check existence of matrix-ma1sd service - ansible.builtin.stat: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-ma1sd.service" - register: matrix_ma1sd_service_stat - when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists" - -- name: Ensure matrix-ma1sd is stopped - ansible.builtin.service: - name: matrix-ma1sd - state: stopped - daemon_reload: true - when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists and matrix_ma1sd_service_stat.stat.exists" - -# We use shell commands for the migration, because the Ansible copy module cannot -# recursively copy remote directories (like `/matrix/mxisd/data/sign.key`) in older versions of Ansible. -- when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists" - block: - - name: Copy mxisd data files to ma1sd folder - ansible.builtin.command: - cmd: "cp -ar {{ matrix_base_data_path }}/mxisd/data {{ matrix_ma1sd_base_path }}" - register: matrix_ma1sd_migrate_mxisd_data_files_copying_result - changed_when: matrix_ma1sd_migrate_mxisd_data_files_copying_result.rc == 0 - - - name: Check existence of mxisd.db file - ansible.builtin.stat: - path: "{{ matrix_ma1sd_data_path }}/mxisd.db" - register: matrix_ma1sd_mxisd_db_stat - - - name: Rename database (mxisd.db -> ma1sd.db) - ansible.builtin.command: - cmd: "mv {{ matrix_ma1sd_data_path }}/mxisd.db {{ matrix_ma1sd_data_path }}/ma1sd.db" - register: matrix_ma1sd_migrate_mxisd_move_db_result - changed_when: matrix_ma1sd_migrate_mxisd_move_db_result.rc == 0 - when: "matrix_ma1sd_mxisd_db_stat.stat.exists" - - - name: Rename mxisd folder - ansible.builtin.command: - cmd: "mv {{ matrix_base_data_path }}/mxisd {{ matrix_base_data_path }}/mxisd.migrated" - register: matrix_ma1sd_migrate_mxisd_move_directory_result - changed_when: matrix_ma1sd_migrate_mxisd_move_directory_result.rc == 0 - -- name: Ensure outdated matrix-mxisd.service doesn't exist - ansible.builtin.file: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-mxisd.service" - state: absent - when: "matrix_mxisd_service_stat.stat.exists" - -- name: Ensure systemd reloaded after removing outdated matrix-mxisd.service - ansible.builtin.service: - daemon_reload: true - when: "matrix_mxisd_service_stat.stat.exists" diff --git a/roles/custom/matrix-ma1sd/tasks/setup_install.yml b/roles/custom/matrix-ma1sd/tasks/setup_install.yml index b9668a053..9b86008ae 100644 --- a/roles/custom/matrix-ma1sd/tasks/setup_install.yml +++ b/roles/custom/matrix-ma1sd/tasks/setup_install.yml @@ -13,9 +13,6 @@ - {path: "{{ matrix_ma1sd_docker_src_files_path }}", when: "{{ matrix_ma1sd_container_image_self_build }}"} when: "item.when | bool" -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_mxisd.yml" - - # These (SQLite -> Postgres) migration tasks are usually at the top, # but we'd like to run them after `migrate_mxisd.yml`, which requires the ma1sd paths to exist. - ansible.builtin.set_fact: diff --git a/roles/custom/matrix-synapse/tasks/ext/encryption-disabler/setup.yml b/roles/custom/matrix-synapse/tasks/ext/encryption-disabler/setup.yml deleted file mode 100644 index e0e61df8e..000000000 --- a/roles/custom/matrix-synapse/tasks/ext/encryption-disabler/setup.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_install.yml" - when: matrix_synapse_ext_encryption_disabler_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_uninstall.yml" - when: "not matrix_synapse_ext_encryption_disabler_enabled | bool" diff --git a/roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup.yml b/roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup_install.yml similarity index 79% rename from roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup.yml rename to roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup_install.yml index 5d648c848..c13a04044 100644 --- a/roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup.yml +++ b/roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup_install.yml @@ -9,4 +9,3 @@ + [{'name': 'ldap_auth_provider', 'level': 'INFO'}] }} - when: matrix_synapse_ext_password_provider_ldap_enabled | bool diff --git a/roles/custom/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml b/roles/custom/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml deleted file mode 100644 index 1a3e097dc..000000000 --- a/roles/custom/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_install.yml" - when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_uninstall.yml" - when: "not matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool" diff --git a/roles/custom/matrix-synapse/tasks/ext/rest-auth/setup.yml b/roles/custom/matrix-synapse/tasks/ext/rest-auth/setup.yml deleted file mode 100644 index 6df360ce9..000000000 --- a/roles/custom/matrix-synapse/tasks/ext/rest-auth/setup.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_install.yml" - when: matrix_synapse_ext_password_provider_rest_auth_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_uninstall.yml" - when: "not matrix_synapse_ext_password_provider_rest_auth_enabled | bool" diff --git a/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/setup.yml b/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/setup.yml deleted file mode 100644 index aefa49fe4..000000000 --- a/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/setup.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/validate_config.yml" - when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup_install.yml" - when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup_uninstall.yml" - when: not matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool diff --git a/roles/custom/matrix-synapse/tasks/ext/setup.yml b/roles/custom/matrix-synapse/tasks/ext/setup.yml index 6cf1afaa4..eea2da377 100644 --- a/roles/custom/matrix-synapse/tasks/ext/setup.yml +++ b/roles/custom/matrix-synapse/tasks/ext/setup.yml @@ -1,15 +1,78 @@ --- -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup.yml" +# encryption-disabler +- block: + - when: matrix_synapse_ext_encryption_disabler_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_install.yml" -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup.yml" + - when: not matrix_synapse_ext_encryption_disabler_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_uninstall.yml" + tags: + - setup-all + - setup-synapse -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup.yml" +# rest-auth +- block: + - when: matrix_synapse_ext_password_provider_rest_auth_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_install.yml" -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup.yml" + - when: not matrix_synapse_ext_password_provider_rest_auth_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_uninstall.yml" + tags: + - setup-all + - setup-synapse -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup.yml" +# shared-secret-auth +- block: + - when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_install.yml" -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup.yml" + - when: not matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_uninstall.yml" + tags: + - setup-all + - setup-synapse -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup.yml" +# ldap-auth +- block: + - when: matrix_synapse_ext_password_provider_ldap_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup_install.yml" + tags: + - setup-all + - setup-synapse + +# synapse-simple-antispam +- block: + - when: matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_install.yml" + + - when: not matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_uninstall.yml" + tags: + - setup-all + - setup-synapse + +# mjolnir-antispam +- block: + - when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_install.yml" + + - when: not matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_uninstall.yml" + tags: + - setup-all + - setup-synapse + +# s3-storage-provider +- block: + - when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/validate_config.yml" + + - when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup_install.yml" + + - when: not matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup_uninstall.yml" + tags: + - setup-all + - setup-synapse diff --git a/roles/custom/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml b/roles/custom/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml deleted file mode 100644 index 6dc385d37..000000000 --- a/roles/custom/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_install.yml" - when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_uninstall.yml" - when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool" diff --git a/roles/custom/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml b/roles/custom/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml deleted file mode 100644 index 038eea749..000000000 --- a/roles/custom/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_install.yml" - when: matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool - -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_uninstall.yml" - when: "not matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool" diff --git a/roles/custom/matrix-synapse/tasks/goofys/setup.yml b/roles/custom/matrix-synapse/tasks/goofys/setup.yml index 2f9eaa870..d8768d89d 100644 --- a/roles/custom/matrix-synapse/tasks/goofys/setup.yml +++ b/roles/custom/matrix-synapse/tasks/goofys/setup.yml @@ -1,7 +1,11 @@ --- -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml" - when: matrix_s3_media_store_enabled | bool +- block: + - when: matrix_s3_media_store_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml" -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml" - when: "not matrix_s3_media_store_enabled | bool" + - when: not matrix_s3_media_store_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml" + tags: + - setup-all + - setup-synapse diff --git a/roles/custom/matrix-synapse/tasks/main.yml b/roles/custom/matrix-synapse/tasks/main.yml index 1e9122167..208be5006 100644 --- a/roles/custom/matrix-synapse/tasks/main.yml +++ b/roles/custom/matrix-synapse/tasks/main.yml @@ -20,11 +20,8 @@ - when: matrix_synapse_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" - - when: matrix_synapse_enabled | bool - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_synapse.yml" - - - when: not matrix_synapse_enabled | bool - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + # This handles both install and uninstal. It's quite messy and should be reworked. + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_synapse.yml" tags: - setup-all - setup-synapse