From: Ralf Jung Date: Sat, 16 Jun 2018 18:01:27 +0000 (+0200) Subject: permit configuring mail system hostname X-Git-Url: https://git.ralfj.de/ansible.git/commitdiff_plain/dec35a3f16cf549b18439409490e529c0b89bdd8?hp=e7f0dda5b871d22ea9925aeaf8a1513d9833128b permit configuring mail system hostname --- diff --git a/host_vars/template.yml b/host_vars/template.yml index fb971ba..6b9c4c7 100644 --- a/host_vars/template.yml +++ b/host_vars/template.yml @@ -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 diff --git a/roles/email/templates/main.cf b/roles/email/templates/main.cf index cbd7b3d..f6840cc 100644 --- a/roles/email/templates/main.cf +++ b/roles/email/templates/main.cf @@ -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