aboutsummaryrefslogtreecommitdiff
path: root/roles/postfix/tasks
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-07-02 19:04:30 -0400
committerSam Chudnick <sam@chudnick.com>2023-07-02 19:04:30 -0400
commit724d877995dfcc10c462a18dcb4ea6c8b60c2d03 (patch)
tree270537b8fca585717c1ffa7708e492593f7b2ed5 /roles/postfix/tasks
initial commit
Diffstat (limited to 'roles/postfix/tasks')
-rw-r--r--roles/postfix/tasks/main.yml84
1 files changed, 84 insertions, 0 deletions
diff --git a/roles/postfix/tasks/main.yml b/roles/postfix/tasks/main.yml
new file mode 100644
index 0000000..0b482ea
--- /dev/null
+++ b/roles/postfix/tasks/main.yml
@@ -0,0 +1,84 @@
1- name: install packages
2 package:
3 name:
4 - postfix
5 state: latest
6
7- name: deploy postfix main.cf
8 template:
9 src: main.cf.j2
10 dest: /etc/postfix/main.cf
11 owner: root
12 group: root
13 mode: '0644'
14
15- name: deploy postfix master.cf
16 template:
17 src: master.cf.j2
18 dest: /etc/postfix/master.cf
19 owner: root
20 group: root
21 mode: '0644'
22
23- name: create mailadmin user
24 user:
25 name: mailadmin
26 shell: /usr/sbin/nologin
27 password_lock: yes
28
29- name: deploy aliases file
30 template:
31 src: aliases
32 dest: /etc/aliases
33 owner: root
34 group: root
35 mode: '0644'
36
37- name: deploy login_maps
38 template:
39 src: login_maps
40 dest: /etc/postfix/login_maps
41 owner: root
42 group: root
43 mode: '0644'
44
45- name: deploy local_maps
46 template:
47 src: local_maps
48 dest: /etc/postfix/local_maps
49 owner: root
50 group: root
51 mode: '0644'
52
53- name: update address databases
54 shell: |
55 newaliases
56 postmap /etc/postfix/login_maps
57 postmap /etc/postfix/local_maps
58
59- name: deploy header checks file
60 copy:
61 src: header_checks
62 dest: /etc/postfix/header_checks
63 owner: root
64 group: root
65 mode: '0644'
66
67- name: deploy body checks file
68 copy:
69 src: body_checks
70 dest: /etc/postfix/body_checks
71 owner: root
72 group: root
73 mode: '0644'
74
75- name: enable postfix
76 systemd:
77 enabled: yes
78 masked: no
79 name: postfix
80
81- name: restart postfix
82 service:
83 name: postfix
84 state: restarted