Files
kevinveenbirkenbachandClaude Opus 5.5 b37cf2e9fe fix(mail): retry a connection the mail server drops before its greeting
Stalwart closes a connection that exceeds its per-IP connection budget
without a greeting. msmtp reports that as "the server sent an empty reply"
with exit 76, and the mail health check treated exit 76 as permanent. One
such drop, in a second in which Alertmanager flushed its notifications,
failed a deploy although the same path accepted a mail one second later.

The health check now retries exit 76 when msmtp names the empty reply,
within the ten attempts it already gives to exit 69, 75 and 124. Every
other protocol error still ends the check at once.

The alarm mail was sent once, so the alarm about a failed unit was lost to
the same drop. It now makes three attempts ten seconds apart for the
transient cases of the health check and still reports the last error.

The limit on the server is left alone. Exempting the node's own senders by
source address would also exempt Tor clients and, in swarm, every external
client. That question is tracked in #793.

Closes #790

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 11:44:58 +02:00
..
2026-05-09 01:54:54 +02:00

Automated Email Alerts for Service Failures

Description

This role installs and configures the necessary components for sending email notifications via systemd when a service fails. It sets up the {{ system_service_id }} service and configures email parameters and templates using msmtp.

Overview

Optimized for secure and reliable service failure notifications, this role is an integral part of the overall sys-ctl-alm-compose suite. It ensures that, upon failure of a critical service, an email alert is sent automatically to enable prompt troubleshooting.

Cosmos

The diagram places Automated Email Alerts for Service Failures in the Infinito.Nexus cosmos: the components it deploys (capabilities), the central services it consumes (dependencies), and its outward reach (federation and bridged external networks).

flowchart LR
    subgraph deps [Dependencies]
        dep_web_app_stalwart["web-app-stalwart 🐳🐝"]
    end
    subgraph role [sys-ctl-alm-email 💻]
        svc_email["email"]
    end
    dep_web_app_stalwart -- "1:1" --> svc_email

Solid 1:1 edges are fixed relationships; dashed 0..1 edges are conditional (enabled only in matching deployments); red 0..0 edges are turned off in this role. Node markers show the role's deploy modes (💻 host, 🐳 compose, 🐝 swarm); ❌ marks a service that is explicitly turned off, and ⚙️ an Ansible role dependency declared in meta/main.yml.

Purpose

The primary purpose of this role is to provide a comprehensive solution for automated email notifications in a systemd environment. By integrating with msmtp and customizable templates, it delivers clear and timely alerts about service failures, thereby enhancing system reliability.

Features

  • Service Installation & Configuration: Installs msmtp and configures the email sending service.
  • Customizable Templates: Supports tailoring email templates for service failure notifications.
  • Secure Notifications: Integrates with systemd to trigger email alerts when services fail.
  • Suite Integration: Part of the sys-ctl-alm-compose suite, offering a unified approach to service failure notifications.

Credits

Implemented by Kevin Veen-Birkenbach. Part of the Infinito.Nexus Project and maintained by Kevin Veen-Birkenbach. Licensed under the Infinito.Nexus Community License (Non-Commercial).