opensmtpd: configure root mail alias

And add a README.
This commit is contained in:
Timotej Lazar 2025-08-11 14:07:45 +02:00
parent b64a5880b9
commit 7bb27acd2c
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,3 @@
Install opensmtpd and configure it for sending local mail through a relay.
The NetBox configuration context must define `mail_relay` with the relay hostname and `mail_root` with the email address where mail for root should be forwarded.

View file

@ -27,6 +27,12 @@
follow: true
notify: restart smtpd
- name: Configure root mail alias
lineinfile:
path: /etc/smtpd/aliases
regexp: "^#? *root:"
line: "root: {{ mail_root }}"
- name: Enable mail server
service:
name: "{% if ansible_os_family == 'Alpine' %}smtpd{% else %}opensmtpd{% endif %}"