Untangle the setup import/include mess in matrix-synapse

development
Slavi Pantaleev 2 years ago
parent d29b0aeddb
commit 2e7b5c7b02

@ -4,9 +4,6 @@
- block: - block:
- when: matrix_synapse_ext_encryption_disabler_enabled | bool - when: matrix_synapse_ext_encryption_disabler_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_install.yml" ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_install.yml"
- when: not matrix_synapse_ext_encryption_disabler_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_uninstall.yml"
tags: tags:
- setup-all - setup-all
- setup-synapse - setup-synapse
@ -15,9 +12,6 @@
- block: - block:
- when: matrix_synapse_ext_password_provider_rest_auth_enabled | bool - 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.include_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_install.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: tags:
- setup-all - setup-all
- setup-synapse - setup-synapse
@ -26,9 +20,6 @@
- block: - block:
- when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool - 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.include_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_install.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: tags:
- setup-all - setup-all
- setup-synapse - setup-synapse
@ -45,9 +36,6 @@
- block: - block:
- when: matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool - 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" 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: tags:
- setup-all - setup-all
- setup-synapse - setup-synapse
@ -56,9 +44,6 @@
- block: - block:
- when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool - when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_install.yml" 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: tags:
- setup-all - setup-all
- setup-synapse - setup-synapse
@ -70,9 +55,6 @@
- when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool - when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup_install.yml" 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: tags:
- setup-all - setup-all
- setup-synapse - setup-synapse

@ -0,0 +1,52 @@
---
# encryption-disabler
- block:
- 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
# rest-auth
- block:
- 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
# shared-secret-auth
- block:
- 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
# ldap-auth has no uninstall tasks
# synapse-simple-antispam
- block:
- 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: 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: 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

@ -1,11 +0,0 @@
---
- block:
- when: matrix_s3_media_store_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml"
- when: not matrix_s3_media_store_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml"
tags:
- setup-all
- setup-synapse

@ -2,7 +2,7 @@
# Unless `matrix_synapse_workers_enabled_list` is explicitly defined, # Unless `matrix_synapse_workers_enabled_list` is explicitly defined,
# we'll generate it dynamically. # we'll generate it dynamically.
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/inject_into_nginx_proxy.yml" - ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/init.yml"
when: "matrix_synapse_workers_enabled | bool and matrix_synapse_workers_enabled_list | length == 0" when: "matrix_synapse_workers_enabled | bool and matrix_synapse_workers_enabled_list | length == 0"
- name: Ensure workers are injected into various places - name: Ensure workers are injected into various places

@ -20,8 +20,11 @@
- when: matrix_synapse_enabled | bool - when: matrix_synapse_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
# This handles both install and uninstal. It's quite messy and should be reworked. - when: matrix_synapse_enabled | bool
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_synapse.yml" ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
- when: not matrix_synapse_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
tags: tags:
- setup-all - setup-all
- setup-synapse - setup-synapse

@ -16,12 +16,35 @@
# We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml), # We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml),
# because if it's using Goofys and it's already mounted (from before), # because if it's using Goofys and it's already mounted (from before),
# trying to chown/chmod it here will cause trouble. # trying to chown/chmod it here will cause trouble.
when: "(matrix_synapse_enabled | bool or matrix_s3_media_store_enabled | bool) and item.when" when: item.when | bool
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/setup.yml" - block:
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/workers/setup.yml" - ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/setup_uninstall.yml"
tags:
- setup-all
- setup-synapse
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/setup.yml" - block:
- when: matrix_synapse_workers_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_install.yml"
tags:
- setup-all
- setup-synapse
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup.yml" - block:
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/setup_install.yml"
tags:
- setup-all
- setup-synapse
- block:
- when: matrix_s3_media_store_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml"
- when: not matrix_s3_media_store_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml"
tags:
- setup-all
- setup-synapse

@ -0,0 +1,27 @@
---
- block:
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/setup_uninstall.yml"
tags:
- setup-all
- setup-synapse
- block:
- when: not matrix_synapse_workers_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_uninstall.yml"
tags:
- setup-all
- setup-synapse
- block:
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/setup_uninstall.yml"
tags:
- setup-all
- setup-synapse
- block:
- when: not matrix_s3_media_store_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml"
tags:
- setup-all
- setup-synapse

@ -1,21 +0,0 @@
---
# A previous version of the worker setup used this.
# This is a temporary cleanup for people who ran that version.
- name: Ensure old matrix-synapse.service.wants directory is gone
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-synapse.service.wants"
state: absent
# Same. This was part of a previous version of the worker setup.
# No longer necessary.
- name: Ensure matrix-synapse-worker-write-pid script is removed
ansible.builtin.file:
path: "{{ matrix_local_bin_path }}/matrix-synapse-worker-write-pid"
state: absent
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_install.yml"
when: "matrix_synapse_enabled | bool and matrix_synapse_workers_enabled | bool"
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_uninstall.yml"
when: "not matrix_synapse_workers_enabled | bool"
Loading…
Cancel
Save