From b412210d56f93393603dd0528ea754a03b535ca8 Mon Sep 17 00:00:00 2001 From: otthorn Date: Thu, 14 Jan 2021 12:15:48 +0100 Subject: [PATCH] Add (initial) postfix role --- roles/postfix/handlers/main.yml | 6 +++++ roles/postfix/tasks/main.yml | 15 ++++++++++++ roles/postfix/templates/main.cf.j2 | 37 ++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 roles/postfix/handlers/main.yml create mode 100644 roles/postfix/tasks/main.yml create mode 100644 roles/postfix/templates/main.cf.j2 diff --git a/roles/postfix/handlers/main.yml b/roles/postfix/handlers/main.yml new file mode 100644 index 0000000..d8755a0 --- /dev/null +++ b/roles/postfix/handlers/main.yml @@ -0,0 +1,6 @@ +--- +# Restart Postfix +- name: Restart postfix service + service: + name: postfix + state: restarted diff --git a/roles/postfix/tasks/main.yml b/roles/postfix/tasks/main.yml new file mode 100644 index 0000000..4b5c269 --- /dev/null +++ b/roles/postfix/tasks/main.yml @@ -0,0 +1,15 @@ +--- +# Install and configure Postfix + +- name: Install Postfix + apt: + name: postfix + update_cache: true # apt update beforehand + +- name: Configure Postfix + template: + src: main.cf.j2 + dest: /etc/postfix/main.cf + notify: Restart postfix service + + diff --git a/roles/postfix/templates/main.cf.j2 b/roles/postfix/templates/main.cf.j2 new file mode 100644 index 0000000..82aacd5 --- /dev/null +++ b/roles/postfix/templates/main.cf.j2 @@ -0,0 +1,37 @@ +# {{ ansible_managed }} +# See /usr/share/postfix/main.cf.dist for a full commented version +# See BASIC_CONFIGURATION_README and STANDARD_CONFIGURATION_README for more insights +# More generally, see the Postfix documentation at http://www.postfix.org + +smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) +biff = no + +# appending .domain is the MUA's job. +append_dot_mydomain = no + +# Uncomment the next line to generate "delayed mail" warnings +#delay_warning_time = 4h + +readme_directory = no + +# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on +# fresh installs. +compatibility_level = 2 + +# Send mail as user@{{ myorigin }} +# myorigin = auro.re +myorigin = {{ myorigin }} + +#myhostname = mail.adm.auro.re +myhostname = {{ myhostname }} + +mydestination = $myhostname localhost.{{ myorigin }} localhost {{ myorigin }} + +# Specify the trusted networks +mynetworks = 127.0.0.0/8 {{ local_network }} + +# This host does not relay mail from untrusted networks +relay_domains = + +# Allow plus delimiter +recipient_delimiter = +