From 180e0b6d7927e1f74af22a7c939fe1ae84867660 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 4 Jan 2024 14:14:38 +0100 Subject: Install postfix and configure it as a nullmailer. --- tasks/mail.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tasks/mail.yml (limited to 'tasks') diff --git a/tasks/mail.yml b/tasks/mail.yml new file mode 100644 index 0000000..89d8530 --- /dev/null +++ b/tasks/mail.yml @@ -0,0 +1,38 @@ +- name: Install Postfix + apt: pkg=postfix + +- name: Add some common aliases + lineinfile: dest=/etc/aliases create=yes + 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: 'hostmaster@{{ ansible_domain }}' } + notify: + - Run newaliases + +- name: Configure Postfix + template: src=etc/postfix/main.cf.j2 + dest=/etc/postfix/main.cf + owner=root group=root + mode=0644 + notify: + - Reload Postfix + +- name: Start Postfix + service: name=postfix.service enabled=true state=started + +- name: Copy /etc/postfix/tls_policy + copy: src=etc/postfix/tls_policy + dest=/etc/postfix/tls_policy + owner=root group=root + mode=0644 + notify: + - Compile /etc/postfix/tls_policy + +- meta: flush_handlers + +- name: Install s-nail + apt: pkg=s-nail -- cgit v1.2.3