From 1b05343aba19852d627ded4934c0580960aaadb9 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 26 Feb 2025 08:00:17 +0200 Subject: [PATCH] Remove Email2Matrix support --- CHANGELOG.md | 9 ++ docs/configuring-playbook-email2matrix.md | 136 +----------------- docs/configuring-playbook.md | 2 +- docs/self-building.md | 1 - group_vars/matrix_servers | 30 ---- .../matrix-email2matrix/defaults/main.yml | 80 ----------- .../custom/matrix-email2matrix/tasks/main.yml | 25 ---- .../tasks/setup_install.yml | 78 ---------- .../tasks/setup_uninstall.yml | 31 ---- .../tasks/validate_config.yml | 27 ---- .../templates/config.json.j2 | 14 -- .../templates/config.json.j2.license | 3 - .../systemd/matrix-email2matrix.service.j2 | 44 ------ .../matrix-email2matrix.service.j2.license | 4 - .../tasks/validate_config.yml | 12 ++ setup.yml | 1 - 16 files changed, 29 insertions(+), 468 deletions(-) delete mode 100644 roles/custom/matrix-email2matrix/defaults/main.yml delete mode 100644 roles/custom/matrix-email2matrix/tasks/main.yml delete mode 100644 roles/custom/matrix-email2matrix/tasks/setup_install.yml delete mode 100644 roles/custom/matrix-email2matrix/tasks/setup_uninstall.yml delete mode 100644 roles/custom/matrix-email2matrix/tasks/validate_config.yml delete mode 100644 roles/custom/matrix-email2matrix/templates/config.json.j2 delete mode 100644 roles/custom/matrix-email2matrix/templates/config.json.j2.license delete mode 100644 roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2 delete mode 100644 roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2.license diff --git a/CHANGELOG.md b/CHANGELOG.md index a25aebfda..070d18e17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 2025-02-26 + +## ðŸŠĶ Bye-bye, Email2Matrix + +The [Email2Matrix](./docs/configuring-playbook-email2matrix.md) service has been superseded by the [Postmoogle](./docs/configuring-playbook-bridge-postmoogle.md) bridge for a long time now and was completely removed from the playbook today. + +If you still have the Email2Matrix component installed on your Matrix server, the playbook can no longer help you uninstall it and you will need to do it manually as described in the [Uninstalling Email2Matrix manually](./docs/configuring-playbook-email2matrix.md#uninstalling-email2matrix-manually) section of the documentation. The playbook will warn you if there are any `matrix_email2matrix_*` variables still remaining in your configuration. + + # 2025-02-23 ## The playbook defaults to exposing the Coturn STUN port (3478) over UDP once again diff --git a/docs/configuring-playbook-email2matrix.md b/docs/configuring-playbook-email2matrix.md index ce2cd2570..4044ec565 100644 --- a/docs/configuring-playbook-email2matrix.md +++ b/docs/configuring-playbook-email2matrix.md @@ -10,139 +10,17 @@ SPDX-License-Identifier: AGPL-3.0-or-later # Setting up Email2Matrix (optional, deprecated) -**Note**: this component has been deprecated. We recommend not bothering with installing it. While not a 1:1 replacement, the author suggests taking a look at [Postmoogle](https://github.com/etkecc/postmoogle) as a replacement, which can also be installed using [this playbook](configuring-playbook-bridge-postmoogle.md). Consider using that component instead of this one. +ðŸŠĶ The playbook used to be able to install and configure [Email2Matrix](https://github.com/devture/email2matrix), but no longer includes this component. -The playbook can install and configure [Email2Matrix](https://github.com/devture/email2matrix) for you. +For a long time now, it been replaced by the much better and more maintained [Postmoogle](https://github.com/etkecc/postmoogle) bridge, which can also be [installed using this playbook](configuring-playbook-bridge-postmoogle.md). -See the project's [documentation](https://github.com/devture/email2matrix/blob/master/docs/README.md) to learn what it does and why it might be useful to you. -## Preparation +## Uninstalling Email2Matrix manually -### Port availability - -Ensure that port 25 is available on your Matrix server and open in your firewall. - -If you have `postfix` or some other email server software installed, you may need to manually remove it first (unless you need it, of course). - -If you really need to run an email server on the Matrix machine for other purposes, it may be possible to run Email2Matrix on another port (with a configuration like `matrix_email2matrix_smtp_host_bind_port: "127.0.0.01:2525"`) and have your other email server relay messages there. - -For details about using Email2Matrix alongside [Postfix](http://www.postfix.org/), see [here](https://github.com/devture/email2matrix/blob/master/docs/setup_with_postfix.md). - -### Register a dedicated Matrix user (optional, recommended) - -We recommend that you create a dedicated Matrix user for Email2Matrix. - -Generate a strong password for the user. You can create one with a command like `pwgen -s 64 1`. - -You can use the playbook to [register a new user](registering-users.md): +If you still have the Email2Matrix component installed on your Matrix server, the playbook can no longer help you uninstall it and you will need to do it manually. To uninstall manually, run these commands on the server: ```sh -ansible-playbook -i inventory/hosts setup.yml --extra-vars='username=email2matrix password=PASSWORD_FOR_THE_USER admin=no' --tags=register-user -``` - -Take note of the user's ID as it needs to be specified as `MatrixUserId` on your `inventory/host_vars/matrix.example.com/vars.yml` file later. - -### Obtain an access token - -Email2Matrix requires an access token for the sender user to be able to send messages to the room. Refer to the documentation on [how to obtain an access token](obtaining-access-tokens.md). - -> [!WARNING] -> Access tokens are sensitive information. Do not include them in any bug reports, messages, or logs. Do not share the access token with anyone. - -### Join to rooms as the sender user manually - -â„đïļ **Email2Matrix does not accept room invitations automatically**. To deliver messages to rooms, the sender user must be joined to all rooms manually. - -For each new room you would like the user to deliver messages to, invite the user to the room. - -Then, log in as the sender user using any Matrix client of your choosing, accept the room invitation from the user's account. - -Make sure that you and the sender user are part of the same room and that the sender user has enough privileges in the room to be able to send messages there, then log out. - -Take note of each room's room ID (different clients show the room ID in a different place). You'll need the room ID when [configuring the playbook](#adjusting-the-playbook-configuration) below. - -## Adjusting DNS records - -To increase the chances that incoming emails reach your server, you can set up a `MX` record for `matrix.example.com` that looks like this: - -| Type | Host | Priority | Weight | Port | Target | -|------|----------|----------|--------|------|------------------------------------| -| MX | `matrix` | 10 | 0 | - | `matrix.example.com` | - -## Adjusting the playbook configuration - -To enable Email2Matrix, add the following configuration to your `vars.yml` file. Make sure to replace `ACCESS_TOKEN_FOR_EMAIL2MATRIX1_HERE` and `ACCESS_TOKEN_FOR_EMAIL2MATRIX2_HERE` with the ones created [above](#obtain-an-access-token). - -```yaml -matrix_email2matrix_enabled: true - -# You need at least 1 mailbox. -matrix_email2matrix_matrix_mappings: - - MailboxName: "mailbox1" - MatrixRoomId: "!qporfwt:{{ matrix_domain }}" - MatrixHomeserverUrl: "{{ matrix_homeserver_url }}" - MatrixUserId: "@email2matrix1:{{ matrix_domain }}" - MatrixAccessToken: "ACCESS_TOKEN_FOR_EMAIL2MATRIX1_HERE" - IgnoreSubject: false - IgnoreBody: false - SkipMarkdown: false - - - MailboxName: "mailbox2" - MatrixRoomId: "!aaabaa:{{ matrix_domain }}" - MatrixHomeserverUrl: "{{ matrix_homeserver_url }}" - MatrixUserId: "@email2matrix2:{{ matrix_domain }}" - MatrixAccessToken: "ACCESS_TOKEN_FOR_EMAIL2MATRIX2_HERE" - IgnoreSubject: true - IgnoreBody: false - SkipMarkdown: true -``` - -where: - -* MailboxName — local-part of the email address, through which emails are bridged to the room whose ID is defined with MatrixRoomId -* MatrixRoomId — internal ID of the room, to which received emails are sent as Matrix message -* MatrixHomeserverUrl — URL of your Matrix homeserver, through which to send Matrix messages. You can also set `MatrixHomeserverUrl` to the container URL where your homeserver's Client-Server API lives by using the `{{ matrix_addons_homeserver_client_api_url }}` variable -* MatrixUserId — the full ID of the sender user which sends bridged messages to the room. On this configuration it is `@email2matrix1:example.com` and `@email2matrix2:example.com` (where `example.com` is your base domain, not the `matrix.` domain) -* MatrixAccessToken — sender user's access token -* IgnoreSubject — if set to "true", the subject is not bridged to Matrix -* IgnoreBody — if set to "true", the message body is not bridged to Matrix -* SkipMarkdown — if set to "true", emails are bridged as plain text Matrix message instead of Markdown (actually HTML) - -Refer to the official documentation [here](https://github.com/devture/email2matrix/blob/master/docs/configuration.md). - -### Extending the configuration - -There are some additional things you may wish to configure about the component. - -Take a look at: - -- `roles/custom/matrix-email2matrix/defaults/main.yml` for some variables that you can customize via your `vars.yml` file - -## Installing - -After configuring the playbook, run it with [playbook tags](playbook-tags.md) as below: - - -```sh -ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start -``` - -**Notes**: - -- The shortcut commands with the [`just` program](just.md) are also available: `just install-service email2matrix` or `just setup-all` - - `just install-service email2matrix` is useful for maintaining your setup quickly when its components remain unchanged. If you adjust your `vars.yml` to remove other components, you'd need to run `just setup-all`, or these components will still remain installed. Note `just setup-all` runs the `ensure-matrix-users-created` tag too. - -- After installation, you may wish to send a test email to the email address assigned to `mailbox1` (default: `mailbox1@matrix.example.com`) to make sure that Email2Matrix works as expected. - -## Troubleshooting - -As with all other services, you can find the logs in [systemd-journald](https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html) by logging in to the server with SSH and running `journalctl -fu matrix-email2matrix`. - -### Increase logging verbosity - -If you want to increase the verbosity, add the following configuration to your `vars.yml` file and re-run the playbook: - -```yaml -matrix_email2matrix_misc_debug: true +systemctl disable --now matrix-email2matrix.service + +rm -rf /matrix/email2matrix ``` diff --git a/docs/configuring-playbook.md b/docs/configuring-playbook.md index 756986f23..9efe8d065 100644 --- a/docs/configuring-playbook.md +++ b/docs/configuring-playbook.md @@ -261,7 +261,7 @@ Various services that don't fit any other categories. - [Setting up the Dimension integration manager](configuring-playbook-dimension.md) ([unmaintained](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2806#issuecomment-1673559299); after [installing](installing.md)) -- [Setting up Email2Matrix](configuring-playbook-email2matrix.md) (unmaintained; the author suggests taking a look at [Postmoogle](https://github.com/etkecc/postmoogle) as a replacement, which can also be installed using [this playbook](configuring-playbook-bridge-postmoogle.md)) +- [Setting up Email2Matrix](configuring-playbook-email2matrix.md) (removed; the author suggests taking a look at [Postmoogle](https://github.com/etkecc/postmoogle) as a replacement, which can also be installed using [this playbook](configuring-playbook-bridge-postmoogle.md)) - [Setting up Go-NEB](configuring-playbook-bot-go-neb.md) (unmaintained; the bridge's author suggests taking a look at [matrix-hookshot](https://github.com/matrix-org/matrix-hookshot) as a replacement, which can also be installed using [this playbook](configuring-playbook-bridge-hookshot.md)) diff --git a/docs/self-building.md b/docs/self-building.md index 543065d89..d09e587df 100644 --- a/docs/self-building.md +++ b/docs/self-building.md @@ -38,7 +38,6 @@ Possibly outdated list of roles where self-building the Docker image is currentl - `matrix-bot-honoroit` - `matrix-bot-matrix-reminder-bot` - `matrix-bot-maubot` -- `matrix-email2matrix` - `matrix-pantalaimon` Adding self-building support to other roles is welcome. Feel free to contribute! diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 623fd763d..6f1b45607 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -3714,36 +3714,6 @@ matrix_dynamic_dns_container_network: matrix-dynamic-dns # ###################################################################### -###################################################################### -# -# matrix-email2matrix -# -###################################################################### - -matrix_email2matrix_enabled: false - -matrix_email2matrix_systemd_required_services_list_auto: | - {{ - matrix_addons_homeserver_systemd_services_list - }} - -matrix_email2matrix_docker_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_email2matrix_docker_image_registry_prefix_upstream_default }}" - -matrix_email2matrix_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm32', 'arm64'] }}" - -matrix_email2matrix_container_network: "{{ matrix_addons_container_network }}" - -matrix_email2matrix_container_additional_networks_auto: |- - {{ - ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) - }} - -###################################################################### -# -# /matrix-email2matrix -# -###################################################################### - ###################################################################### # # jitsi diff --git a/roles/custom/matrix-email2matrix/defaults/main.yml b/roles/custom/matrix-email2matrix/defaults/main.yml deleted file mode 100644 index 43569a6c5..000000000 --- a/roles/custom/matrix-email2matrix/defaults/main.yml +++ /dev/null @@ -1,80 +0,0 @@ -# SPDX-FileCopyrightText: 2019 - 2025 Slavi Pantaleev -# SPDX-FileCopyrightText: 2021 MDAD project contributors -# SPDX-FileCopyrightText: 2021 Ahmad Haghighi -# SPDX-FileCopyrightText: 2022 Marko Weltzer -# SPDX-FileCopyrightText: 2022 Nikita Chernyi -# SPDX-FileCopyrightText: 2023 Samuel Meenzen -# SPDX-FileCopyrightText: 2024 Suguru Hirahara -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- - -# Project source code URL: https://github.com/devture/email2matrix - -matrix_email2matrix_enabled: true - -matrix_email2matrix_base_path: "{{ matrix_base_data_path }}/email2matrix" -matrix_email2matrix_config_dir_path: "{{ matrix_email2matrix_base_path }}/config" -matrix_email2matrix_docker_src_files_path: "{{ matrix_email2matrix_base_path }}/docker-src" - -matrix_email2matrix_container_image_self_build: false -matrix_email2matrix_container_image_self_build_repo: "https://github.com/devture/email2matrix.git" -matrix_email2matrix_container_image_self_build_branch: "{{ matrix_email2matrix_version }}" - -# renovate: datasource=docker depName=devture/email2matrix -matrix_email2matrix_version: 1.1.0 -matrix_email2matrix_docker_image: "{{ matrix_email2matrix_docker_image_registry_prefix }}devture/email2matrix:{{ matrix_email2matrix_version }}" -matrix_email2matrix_docker_image_registry_prefix: "{{ 'localhost/' if matrix_email2matrix_container_image_self_build else matrix_email2matrix_docker_image_registry_prefix_upstream }}" -matrix_email2matrix_docker_image_registry_prefix_upstream: "{{ matrix_email2matrix_docker_image_registry_prefix_upstream_default }}" -matrix_email2matrix_docker_image_registry_prefix_upstream_default: docker.io/ -matrix_email2matrix_docker_image_force_pull: "{{ matrix_email2matrix_docker_image.endswith(':latest') }}" - -matrix_email2matrix_container_network: "" - -matrix_email2matrix_container_additional_networks: "{{ matrix_email2matrix_container_additional_networks_auto + matrix_email2matrix_container_additional_networks_custom }}" -matrix_email2matrix_container_additional_networks_auto: [] -matrix_email2matrix_container_additional_networks_custom: [] - -# A list of extra arguments to pass to the container -matrix_email2matrix_container_extra_arguments: [] - -# List of systemd services that matrix-corporal.service depends on -matrix_email2matrix_systemd_required_services_list: "{{ matrix_email2matrix_systemd_required_services_list_default + matrix_email2matrix_systemd_required_services_list_auto + matrix_email2matrix_systemd_required_services_list_custom }}" -matrix_email2matrix_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" -matrix_email2matrix_systemd_required_services_list_auto: [] -matrix_email2matrix_systemd_required_services_list_custom: [] - -# Controls where the matrix-email2matrix container exposes the SMTP (tcp/2525 in the container). -# -# Takes an ":" or "" value (e.g. "127.0.0.1:2525"). -# -# By default, we listen on port 25 on all of the host's network interfaces. -matrix_email2matrix_smtp_host_bind_port: "25" - -matrix_email2matrix_smtp_hostname: "{{ matrix_server_fqn_matrix }}" - -# A list of mailbox to Matrix mappings. -# -# Example: -# matrix_email2matrix_matrix_mappings: -# - MailboxName: "mailbox1" -# MatrixRoomId: "!qporfwt:{{ matrix_domain }}" -# MatrixHomeserverUrl: "{{ matrix_homeserver_url }}" -# MatrixUserId: "@email2matrix1:{{ matrix_domain }}" -# MatrixAccessToken: "MATRIX_ACCESS_TOKEN_HERE" -# IgnoreSubject: false -# IgnoreBody: false -# SkipMarkdown: false -# -# - MailboxName: "mailbox2" -# MatrixRoomId: "!aaabaa:{{ matrix_domain }}" -# MatrixHomeserverUrl: "{{ matrix_homeserver_url }}" -# MatrixUserId: "@email2matrix2:{{ matrix_domain }}" -# MatrixAccessToken: "MATRIX_ACCESS_TOKEN_HERE" -# IgnoreSubject: true -# IgnoreBody: false -# SkipMarkdown: true -matrix_email2matrix_matrix_mappings: [] - -matrix_email2matrix_misc_debug: false diff --git a/roles/custom/matrix-email2matrix/tasks/main.yml b/roles/custom/matrix-email2matrix/tasks/main.yml deleted file mode 100644 index f557ccaa0..000000000 --- a/roles/custom/matrix-email2matrix/tasks/main.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-FileCopyrightText: 2019 - 2023 Slavi Pantaleev -# SPDX-FileCopyrightText: 2022 Marko Weltzer -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- - -- tags: - - setup-all - - setup-email2matrix - - install-all - - install-email2matrix - block: - - when: matrix_email2matrix_enabled | bool - ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" - - - when: matrix_email2matrix_enabled | bool - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml" - -- tags: - - setup-all - - setup-email2matrix - block: - - when: not matrix_email2matrix_enabled | bool - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" diff --git a/roles/custom/matrix-email2matrix/tasks/setup_install.yml b/roles/custom/matrix-email2matrix/tasks/setup_install.yml deleted file mode 100644 index 242deb01d..000000000 --- a/roles/custom/matrix-email2matrix/tasks/setup_install.yml +++ /dev/null @@ -1,78 +0,0 @@ -# SPDX-FileCopyrightText: 2021 - 2024 Slavi Pantaleev -# SPDX-FileCopyrightText: 2022 Nikita Chernyi -# SPDX-FileCopyrightText: 2022 Marko Weltzer -# SPDX-FileCopyrightText: 2022 Sebastian Gumprich -# SPDX-FileCopyrightText: 2024 David Mehren -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- - -- name: Ensure Email2Matrix paths exist - ansible.builtin.file: - path: "{{ item.path }}" - state: directory - mode: 0750 - owner: "{{ matrix_user_username }}" - group: "{{ matrix_user_groupname }}" - with_items: - - {path: "{{ matrix_email2matrix_base_path }}", when: true} - - {path: "{{ matrix_email2matrix_config_dir_path }}", when: true} - - {path: "{{ matrix_email2matrix_docker_src_files_path }}", when: "{{ matrix_email2matrix_container_image_self_build }}"} - when: "item.when | bool" - -- name: Ensure Email2Matrix configuration file created - ansible.builtin.template: - src: "{{ role_path }}/templates/config.json.j2" - dest: "{{ matrix_email2matrix_config_dir_path }}/config.json" - owner: "{{ matrix_user_username }}" - group: "{{ matrix_user_groupname }}" - mode: 0640 - -- name: Ensure Email2Matrix image is pulled - community.docker.docker_image: - name: "{{ matrix_email2matrix_docker_image }}" - source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" - force_source: "{{ matrix_email2matrix_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_email2matrix_docker_image_force_pull }}" - when: "not matrix_email2matrix_container_image_self_build | bool" - register: result - retries: "{{ devture_playbook_help_container_retries_count }}" - delay: "{{ devture_playbook_help_container_retries_delay }}" - until: result is not failed - -- name: Ensure Email2Matrix repository is present on self-build - ansible.builtin.git: - repo: "{{ matrix_email2matrix_container_image_self_build_repo }}" - dest: "{{ matrix_email2matrix_docker_src_files_path }}" - version: "{{ matrix_email2matrix_container_image_self_build_branch }}" - force: "yes" - become: true - become_user: "{{ matrix_user_username }}" - register: matrix_email2matrix_git_pull_results - when: "matrix_email2matrix_container_image_self_build | bool" - -- name: Ensure Email2Matrix Docker image is built - community.docker.docker_image: - name: "{{ matrix_email2matrix_docker_image }}" - source: build - force_source: "{{ matrix_email2matrix_git_pull_results.changed 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_email2matrix_git_pull_results.changed }}" - build: - dockerfile: etc/docker/Dockerfile - path: "{{ matrix_email2matrix_docker_src_files_path }}" - pull: true - when: "matrix_email2matrix_container_image_self_build | bool" - -- name: Ensure matrix-email2matrix container network is created - community.general.docker_network: - enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" - name: "{{ matrix_email2matrix_container_network }}" - driver: bridge - driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" - -- name: Ensure matrix-email2matrix.service installed - ansible.builtin.template: - src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2" - dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-email2matrix.service" - mode: 0644 diff --git a/roles/custom/matrix-email2matrix/tasks/setup_uninstall.yml b/roles/custom/matrix-email2matrix/tasks/setup_uninstall.yml deleted file mode 100644 index e10464f72..000000000 --- a/roles/custom/matrix-email2matrix/tasks/setup_uninstall.yml +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-FileCopyrightText: 2021 - 2022 Slavi Pantaleev -# SPDX-FileCopyrightText: 2022 Marko Weltzer -# SPDX-FileCopyrightText: 2022 Sebastian Gumprich -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- - -- name: Check existence of matrix-email2matrix service - ansible.builtin.stat: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-email2matrix.service" - register: matrix_email2matrix_service_stat - -- when: matrix_email2matrix_service_stat.stat.exists | bool - block: - - name: Ensure matrix-email2matrix is stopped - ansible.builtin.service: - name: matrix-email2matrix - state: stopped - enabled: false - daemon_reload: true - - - name: Ensure matrix-email2matrix.service doesn't exist - ansible.builtin.file: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-email2matrix.service" - state: absent - - - name: Ensure Email2Matrix data path doesn't exist - ansible.builtin.file: - path: "{{ matrix_email2matrix_base_path }}" - state: absent diff --git a/roles/custom/matrix-email2matrix/tasks/validate_config.yml b/roles/custom/matrix-email2matrix/tasks/validate_config.yml deleted file mode 100644 index 17533397f..000000000 --- a/roles/custom/matrix-email2matrix/tasks/validate_config.yml +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-FileCopyrightText: 2019 - 2024 Slavi Pantaleev -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- - -- name: Fail if no Email2Matrix mappings - ansible.builtin.fail: - msg: > - You need to define at least one mapping in `matrix_email2matrix_matrix_mappings` for enabling Email2Matrix. - when: "matrix_email2matrix_matrix_mappings | length == 0" - -- name: Fail if required Email2Matrix settings not defined - ansible.builtin.fail: - msg: >- - You need to define a required configuration setting (`{{ item.name }}`). - when: "item.when | bool and vars[item.name] == ''" - with_items: - - {'name': 'matrix_email2matrix_container_network', when: true} - -- name: (Deprecation) Catch and report renamed Email2Matrix variables - ansible.builtin.fail: - msg: >- - The variable `{{ item.old }}` is deprecated. Please use `{{ item.new }}` instead. - when: "item.old in vars" - with_items: - - {'old': 'matrix_email2matrix_docker_image_name_prefix', 'new': 'matrix_email2matrix_docker_image_registry_prefix'} diff --git a/roles/custom/matrix-email2matrix/templates/config.json.j2 b/roles/custom/matrix-email2matrix/templates/config.json.j2 deleted file mode 100644 index a7ca7bc47..000000000 --- a/roles/custom/matrix-email2matrix/templates/config.json.j2 +++ /dev/null @@ -1,14 +0,0 @@ -#jinja2: lstrip_blocks: "True" -{ - "Smtp": { - "ListenInterface": "0.0.0.0:2525", - "Hostname": {{ matrix_email2matrix_smtp_hostname|to_json }}, - "Workers": 10 - }, - "Matrix": { - "Mappings": {{ matrix_email2matrix_matrix_mappings | to_nice_json }} - }, - "Misc": { - "Debug": {{ matrix_email2matrix_misc_debug|to_json }} - } -} diff --git a/roles/custom/matrix-email2matrix/templates/config.json.j2.license b/roles/custom/matrix-email2matrix/templates/config.json.j2.license deleted file mode 100644 index 2fe1c727d..000000000 --- a/roles/custom/matrix-email2matrix/templates/config.json.j2.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2019 - 2022 Slavi Pantaleev - -SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2 b/roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2 deleted file mode 100644 index 4b84d13dd..000000000 --- a/roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2 +++ /dev/null @@ -1,44 +0,0 @@ -#jinja2: lstrip_blocks: "True" -[Unit] -Description=Email2Matrix -{% for service in matrix_email2matrix_systemd_required_services_list %} -Requires={{ service }} -After={{ service }} -{% endfor %} -DefaultDependencies=no - -[Service] -Type=simple -Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" -ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-email2matrix 2>/dev/null || true' -ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-email2matrix 2>/dev/null || true' - -ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ - --rm \ - --name=matrix-email2matrix \ - --log-driver=none \ - --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ - --cap-drop=ALL \ - --read-only \ - --network={{ matrix_email2matrix_container_network }} \ - -p {{ matrix_email2matrix_smtp_host_bind_port }}:2525 \ - --mount type=bind,src={{ matrix_email2matrix_config_dir_path }}/config.json,dst=/config.json,ro \ - {% for arg in matrix_email2matrix_container_extra_arguments %} - {{ arg }} \ - {% endfor %} - {{ matrix_email2matrix_docker_image }} - -{% for network in matrix_email2matrix_container_additional_networks %} -ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-email2matrix -{% endfor %} - -ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-email2matrix - -ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-email2matrix 2>/dev/null || true' -ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-email2matrix 2>/dev/null || true' -Restart=always -RestartSec=30 -SyslogIdentifier=matrix-email2matrix - -[Install] -WantedBy=multi-user.target diff --git a/roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2.license b/roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2.license deleted file mode 100644 index d29979396..000000000 --- a/roles/custom/matrix-email2matrix/templates/systemd/matrix-email2matrix.service.j2.license +++ /dev/null @@ -1,4 +0,0 @@ -SPDX-FileCopyrightText: 2019 - 2025 Slavi Pantaleev -SPDX-FileCopyrightText: 2020 Chris van Dijk - -SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/roles/custom/matrix_playbook_migration/tasks/validate_config.yml b/roles/custom/matrix_playbook_migration/tasks/validate_config.yml index 4232196d3..0043e8dd5 100644 --- a/roles/custom/matrix_playbook_migration/tasks/validate_config.yml +++ b/roles/custom/matrix_playbook_migration/tasks/validate_config.yml @@ -476,3 +476,15 @@ The following variables in your configuration need to be removed: {{ vars | dict2items | selectattr('key', 'match', 'matrix_mautrix_hangouts_.*') | map(attribute='key') | join(', ') }} when: "vars | dict2items | selectattr('key', 'match', 'matrix_mautrix_hangouts_.*') | list | items2dict" + +- name: (Deprecation) Catch and report Email2Matrix variables + ansible.builtin.fail: + msg: |- + The Email2Matrix service has been superseded by the Postmoogle bridge for a long time now and was completely removed from the playbook in February 2025. + + Please change your configuration (`vars.yml`) to remove all `matrix_email2matrix_*` variables. + + You may also wish to uninstall the bridge manually. See `docs/configuring-playbook-email2matrix.md` for more information. + + The following variables in your configuration need to be removed: {{ vars | dict2items | selectattr('key', 'match', 'matrix_email2matrix_.*') | map(attribute='key') | join(', ') }} + when: "vars | dict2items | selectattr('key', 'match', 'matrix_email2matrix_.*') | list | items2dict" diff --git a/setup.yml b/setup.yml index d36f16c6b..7149b3cdf 100644 --- a/setup.yml +++ b/setup.yml @@ -126,7 +126,6 @@ - custom/matrix-dimension - galaxy/etherpad - custom/matrix-sliding-sync - - custom/matrix-email2matrix - custom/matrix-sygnal - galaxy/ntfy - custom/matrix-static-files