Browse Source

Untangle the setup import/include mess in matrix-synapse

pull/2298/head
Slavi Pantaleev 3 years ago
parent
commit
2e7b5c7b02
9 changed files with 113 additions and 58 deletions
  1. +0
    -18
      roles/custom/matrix-synapse/tasks/ext/setup_install.yml
  2. +52
    -0
      roles/custom/matrix-synapse/tasks/ext/setup_uninstall.yml
  3. +0
    -11
      roles/custom/matrix-synapse/tasks/goofys/setup.yml
  4. +1
    -1
      roles/custom/matrix-synapse/tasks/inject_into_nginx_proxy.yml
  5. +5
    -2
      roles/custom/matrix-synapse/tasks/main.yml
  6. +28
    -5
      roles/custom/matrix-synapse/tasks/setup_install.yml
  7. +27
    -0
      roles/custom/matrix-synapse/tasks/setup_uninstall.yml
  8. +0
    -0
      roles/custom/matrix-synapse/tasks/synapse/workers/init.yml
  9. +0
    -21
      roles/custom/matrix-synapse/tasks/synapse/workers/setup.yml

roles/custom/matrix-synapse/tasks/ext/setup.yml → roles/custom/matrix-synapse/tasks/ext/setup_install.yml View File

@@ -4,9 +4,6 @@
- block:
- when: matrix_synapse_ext_encryption_disabler_enabled | bool
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:
- setup-all
- setup-synapse
@@ -15,9 +12,6 @@
- block:
- when: matrix_synapse_ext_password_provider_rest_auth_enabled | bool
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:
- setup-all
- setup-synapse
@@ -26,9 +20,6 @@
- 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"

- 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
@@ -45,9 +36,6 @@
- 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
@@ -56,9 +44,6 @@
- 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
@@ -70,9 +55,6 @@

- 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

+ 52
- 0
roles/custom/matrix-synapse/tasks/ext/setup_uninstall.yml View File

@@ -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

+ 0
- 11
roles/custom/matrix-synapse/tasks/goofys/setup.yml View File

@@ -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

+ 1
- 1
roles/custom/matrix-synapse/tasks/inject_into_nginx_proxy.yml View File

@@ -2,7 +2,7 @@

# Unless `matrix_synapse_workers_enabled_list` is explicitly defined,
# 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"

- name: Ensure workers are injected into various places


+ 5
- 2
roles/custom/matrix-synapse/tasks/main.yml View File

@@ -20,8 +20,11 @@
- when: matrix_synapse_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.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"
- when: matrix_synapse_enabled | bool
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:
- setup-all
- setup-synapse


roles/custom/matrix-synapse/tasks/setup_synapse.yml → roles/custom/matrix-synapse/tasks/setup_install.yml View File

@@ -16,12 +16,35 @@
# 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),
# 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

+ 27
- 0
roles/custom/matrix-synapse/tasks/setup_uninstall.yml View File

@@ -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

roles/custom/matrix-synapse/tasks/synapse/workers/inject_into_nginx_proxy.yml → roles/custom/matrix-synapse/tasks/synapse/workers/init.yml View File


+ 0
- 21
roles/custom/matrix-synapse/tasks/synapse/workers/setup.yml View File

@@ -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