opensmtpd: support relaying mail

This commit is contained in:
Timotej Lazar 2025-02-17 15:04:26 +01:00
parent b252e451f6
commit be8e47119f
3 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,5 @@
- name: restart smtpd
service:
name: smtpd
state: restarted
when: "'handler' not in ansible_skip_tags"

View file

@ -1,7 +1,15 @@
# this role is currently for alpine linux only
- name: Install mail server - name: Install mail server
package: package:
name: opensmtpd name: opensmtpd
- name: Configure mail server
template:
dest: /etc/smtpd/smtpd.conf
src: smtpd.conf.j2
notify: restart smtpd
- name: Enable mail server - name: Enable mail server
service: service:
name: smtpd name: smtpd

View file

@ -0,0 +1,9 @@
table aliases file:/etc/smtpd/aliases
listen on lo
action "local" maildir alias <aliases>
action "relay" relay{% if mail_relay is defined %} host smtp+tls://{{ mail_relay }}{% endif +%}
match for local action "local"
match from local for any action "relay"