From a4ecc629b38e9d9d4cf918d6095112347c141e55 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 18 Sep 2016 17:55:33 +0200 Subject: Postfix: ensure common aliases are present. --- roles/amavis/tasks/main.yml | 10 ++++++++++ roles/common/tasks/clamav.yml | 10 ++++++++++ roles/common/tasks/mail.yml | 11 ++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/amavis/tasks/main.yml b/roles/amavis/tasks/main.yml index c061d09..d4298b8 100644 --- a/roles/amavis/tasks/main.yml +++ b/roles/amavis/tasks/main.yml @@ -30,6 +30,16 @@ - Restart ClamAV - Restart Amavis +- name: Add an 'amavis' alias + lineinfile: dest=/etc/aliases create=yes + regexp="^amavis{{':'}} " + line="amavis{{':'}} root" + +- name: Compile the static local Postfix database + postmap: cmd=postalias src=/etc/aliases db=cdb + owner=root group=root + mode=0644 + - name: Create directory /var/lib/dkim file: path=/var/lib/dkim state=directory diff --git a/roles/common/tasks/clamav.yml b/roles/common/tasks/clamav.yml index 3579d31..1c68598 100644 --- a/roles/common/tasks/clamav.yml +++ b/roles/common/tasks/clamav.yml @@ -19,3 +19,13 @@ with_items: - clamav-daemon - clamav-freshclam + +- name: Add a 'clamav' alias + lineinfile: dest=/etc/aliases create=yes + regexp="^clamav{{':'}} " + line="clamav{{':'}} root" + +- name: Compile the static local Postfix database + postmap: cmd=postalias src=/etc/aliases db=cdb + owner=root group=root + mode=0644 diff --git a/roles/common/tasks/mail.yml b/roles/common/tasks/mail.yml index 6f690e6..1877f21 100644 --- a/roles/common/tasks/mail.yml +++ b/roles/common/tasks/mail.yml @@ -36,10 +36,15 @@ notify: - Reload Postfix -- name: Add a 'root' alias +- name: Add some common aliases lineinfile: dest=/etc/aliases create=yes - regexp="^root{{':'}} " - line="root{{':'}} root@fripost.org" + regexp='^{{ item.src }}{{':'}} ' + line='{{ item.src }}{{':'}} {{ item.dst }}' + with_items: + - { src: mailer-daemon, dst: 'postmaster' } + - { src: postmaster, dst: 'root' } + - { src: nobody, dst: 'root' } + - { src: root, dst: 'root@fripost.org' } - name: Compile the static local Postfix database postmap: cmd=postalias src=/etc/aliases db=cdb -- cgit v1.2.3