summaryrefslogtreecommitdiffstats
path: root/tasks
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-01-04 14:14:38 +0100
committerGuilhem Moulin <guilhem@fripost.org>2024-01-04 14:32:30 +0100
commit180e0b6d7927e1f74af22a7c939fe1ae84867660 (patch)
tree496d8b8288940c115e63d3eef7e0e49544ef6417 /tasks
parent6691410f945719e62601c3d69d9b2ff9c4cfb4fb (diff)
Install postfix and configure it as a nullmailer.
Diffstat (limited to 'tasks')
-rw-r--r--tasks/mail.yml38
1 files changed, 38 insertions, 0 deletions
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