From 86ca0fc5f456adaf4e4bc96f8969236a8a84a810 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 22 Jul 2026 15:39:02 +0200 Subject: [PATCH] fix(msmtp): route swarm infra nodes through the manager ingress Nodes outside the mesh (nfs, backup) can neither resolve the onion mail host (no tor resolver) nor reach a locally published SMTP port; hlth-msmtp died with status=68/NOHOST. The manager's ingress publishes the mail ports on every node IP. Co-Authored-By: Claude Fable 5 --- roles/sys-svc-mail-msmtp/templates/msmtprc.conf.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/sys-svc-mail-msmtp/templates/msmtprc.conf.j2 b/roles/sys-svc-mail-msmtp/templates/msmtprc.conf.j2 index ac96596b3f..0bb8947c20 100644 --- a/roles/sys-svc-mail-msmtp/templates/msmtprc.conf.j2 +++ b/roles/sys-svc-mail-msmtp/templates/msmtprc.conf.j2 @@ -1,4 +1,7 @@ {% set email = lookup('email') %} +{% set _smtp_ci = email.external | bool and DOCKER_IN_CONTAINER | bool %} +{% set _smtp_local = _smtp_ci and (DEPLOYMENT_MODE == 'compose' or 'svc-swarm-node' in group_names) %} +{% set _smtp_mgr = _smtp_ci and not _smtp_local and (groups['svc-swarm-manager'] | default([]) | length > 0) %} defaults logfile ~/.msmtp.log timeout {{ email.timeout }} @@ -9,7 +12,7 @@ tls {{ email.tls | on_off }} tls_trust_file {{ sys_svc_mail_msmtp_ca_bundle_override | default(sys_svc_mail_msmtp_ca_bundle) }} tls_host_override {{ email.host }} account system_email_no_reply -host {{ '127.0.0.1' if (email.external | bool and DOCKER_IN_CONTAINER | bool and (DEPLOYMENT_MODE == 'compose' or 'svc-swarm-node' in group_names)) else email.host }} +host {{ '127.0.0.1' if _smtp_local else (groups['svc-swarm-manager'] | first) if _smtp_mgr else email.host }} port {{ email.port }} from {{ email['from'] }} {% if (email.auth | bool) %}