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 fb971ba..6b9c4c7 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 cbd7b3d..f6840cc 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