---

- tags:
    - setup-all
    - setup-mautrix-signal
    - install-all
    - install-mautrix-signal
  block:
    - ansible.builtin.include_tasks: "{{ role_path }}/tasks/remove_legacy.yml"

- tags:
    - setup-all
    - setup-nginx-proxy
    - install-all
    - install-nginx-proxy
  block:
    - when: matrix_mautrix_signal_enabled | bool and matrix_mautrix_signal_metrics_enabled | bool
      ansible.builtin.include_tasks: "{{ role_path }}/tasks/inject_into_nginx_proxy.yml"

- tags:
    - setup-all
    - setup-mautrix-signal
    - install-all
    - install-mautrix-signal
  block:
    - when: matrix_mautrix_signal_enabled | bool
      ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"

    - when: matrix_mautrix_signal_enabled | bool
      ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"

- tags:
    - setup-all
    - setup-mautrix-signal
  block:
    - when: not matrix_mautrix_signal_enabled | bool
      ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"