permit configuring mail system hostname
authorRalf Jung <post@ralfj.de>
Sat, 16 Jun 2018 18:01:27 +0000 (20:01 +0200)
committerRalf Jung <post@ralfj.de>
Sat, 16 Jun 2018 18:01:27 +0000 (20:01 +0200)
host_vars/template.yml
roles/email/templates/main.cf

index fb971bae652e0a7f4529bbb674b74e7636e3beac..6b9c4c790b7656c6a53912123393ab117108ddbf 100644 (file)
@@ -1,6 +1,8 @@
 postfix:
   # postmaster email address
   postmaster: postmaster@example.org
+  # optional: Hostname of this email system
+  hostname: mail.example.org
   # optional: Whether to put a postscreen on port 25
   postscreen: True
   # optional: Open another SMTP daemon on port 26 that only accepts mail from local hosts
index cbd7b3d85c4cdd515b4a24485beebc68938952d7..f6840cc353514f221faa5a4cedadcf0cdcc88835 100644 (file)
@@ -1,12 +1,16 @@
 compatibility_level = 2
 
-# local delivery: aliases only
-alias_maps = hash:/etc/aliases
-local_recipient_maps = $alias_maps
+{% if postfix.hostname is defined %}
+myhostname = {{ postfix.hostname }}
+{% endif %}
 {% if postfix.mynetworks is defined %}
 mynetworks = {{ postfix.mynetworks }}
 {% endif %}
 
+# local delivery: aliases only
+alias_maps = hash:/etc/aliases
+local_recipient_maps = $alias_maps
+
 {% if 'letsencrypt' in group_names %}
 # TLS server parameters
 smtpd_tls_cert_file=/etc/ssl/mycerts/letsencrypt/live.crt+chain