-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05_postfix.yml
47 lines (39 loc) · 1.13 KB
/
05_postfix.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- hosts: all
become: yes
gather_facts: False
tasks:
- name: Install postfix
dnf:
name: postfix
state: present
- name: Allow receiving emails from everywhere
lineinfile:
dest: /etc/postfix/main.cf
regexp: '^\s*inet_interfaces'
line: "inet_interfaces = all"
notify: Restart postfix
- name: Allow only local clients to send emails
lineinfile:
dest: /etc/postfix/main.cf
line: "smtpd_client_restrictions = permit_inet_interfaces"
notify: Restart postfix
- name: Enable virtual_alias_maps
lineinfile:
dest: /etc/postfix/main.cf
line: "virtual_alias_maps = hash:/etc/postfix/virtual"
notify: Restart postfix
- name: Set catch-all email redirect
copy:
dest: /etc/postfix/virtual
content: "@{{ hostname }} {{ target_email }}"
force: yes
notify: Reload virtual table
handlers:
- name: Restart postfix
service:
name: postfix
state: restarted
enabled: yes
- name: Reload virtual table
command: postmap /etc/postfix/virtual