Files
Kevin Veen-Birkenbach 8e4ee723d7 Make mail stack optional for Infinito.Nexus deployments without Mailu (e.g. Raspberry Pi / robots)
Refactored mail-related roles to support running Infinito.Nexus on nodes without a dedicated mail server:
- Introduced sys-svc-mail as central mail orchestration role.
- Split msmtp handling into sys-svc-mail-msmtp.
- Added sys-svc-mail-smtp to provide a localhost-only Postfix relay when Mailu is not present.
- Updated alert/health roles to use the new mail orchestration.
- Avoid installing postfix inside containers via IS_CONTAINER guard.
- Adjusted WordPress role to use the new msmtp template path.

This allows lightweight deployments (e.g. Raspberry Pi, robots, edge nodes) to send mail via localhost without requiring a full Mailu stack.

ChatGPT discussion: https://chatgpt.com/share/6931edf1-cb98-800f-9e3c-a62d69ccb223
2025-12-04 21:24:53 +01:00

43 lines
1.1 KiB
YAML

- include_tasks: utils/once/flag.yml
- block:
- name: "Check if Mail Host is reachable"
uri:
url: "{{ WEB_PROTOCOL }}://{{ SYSTEM_EMAIL.HOST }}"
method: HEAD
validate_certs: yes
status_code: 200
register: mail_host_reachability
failed_when: false
changed_when: false
when:
- run_once_web_app_mailu is not defined
- SYSTEM_EMAIL.HOST == (domains | get_domain('web-app-mailu'))
- name: "Load Mailu Routines for '{{ role_name }}'"
include_tasks: 02_mailu.yml
when:
- >
(
mail_host_reachability is defined and
(mail_host_reachability.status | default(0) | int) != 200
)
or
(
users.get('no-reply', {}).get('mailu_token', '') | length == 0
)
when: "'web-app-mailu' in group_names"
- name: Setup emails via localhost
include_role:
name: sys-svc-mail-smtp
when:
- run_once_sys_svc_mail_smtp is not defined
- "'web-app-mailu' not in group_names"
- name: Setup msmtp client
include_role:
name: sys-svc-mail-msmtp
when:
- run_once_sys_svc_mail_msmtp is not defined