diff options
author | clarkzjw <[email protected]> | 2023-02-08 00:40:09 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-08 00:40:09 -0800 |
commit | 1204730924436ef9e1c7c49c9557837f9a5ed0e8 (patch) | |
tree | 129d79dfd11245751cee6d4082ff5d2f6e941610 /ansible/roles/postfix/tasks | |
parent | 9635ac4dedf69de5bff65785bcc16bef80b52d75 (diff) | |
download | mail-master.tar.gz |
Diffstat (limited to 'ansible/roles/postfix/tasks')
-rw-r--r-- | ansible/roles/postfix/tasks/main.yml | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ansible/roles/postfix/tasks/main.yml b/ansible/roles/postfix/tasks/main.yml new file mode 100644 index 0000000..57b0601 --- /dev/null +++ b/ansible/roles/postfix/tasks/main.yml | |||
@@ -0,0 +1,50 @@ | |||
1 | --- | ||
2 | # postfix install and configuration | ||
3 | # note: this postfix config requires open ports: 25 and 587 | ||
4 | - name: install postfix | ||
5 | apt: | ||
6 | state: latest | ||
7 | pkg: | ||
8 | - postfix | ||
9 | - postfix-doc | ||
10 | - postfix-pcre | ||
11 | |||
12 | - name: give postfix user permission to read private keys | ||
13 | user: | ||
14 | name: postfix | ||
15 | groups: ssl-cert | ||
16 | append: yes | ||
17 | |||
18 | - name: copy postfix config | ||
19 | copy: | ||
20 | src: postfix/ | ||
21 | dest: /etc/postfix/ | ||
22 | mode: preserve | ||
23 | notify: | ||
24 | - restart postfix # NB this could be a reload instead | ||
25 | - rehash postfix aliases | ||
26 | |||
27 | - name: instantiate postfix main.cf template | ||
28 | template: | ||
29 | src: postfix/main.cf.j2 | ||
30 | dest: /etc/postfix/main.cf | ||
31 | notify: | ||
32 | - reload postfix | ||
33 | |||
34 | |||
35 | # verify everything is running | ||
36 | - name: verify services are running in dependency order | ||
37 | service: | ||
38 | name: "{{ item }}" | ||
39 | enabled: yes | ||
40 | state: started | ||
41 | loop: | ||
42 | - postfix | ||
43 | |||
44 | - name: reload if certs newish | ||
45 | include_role: | ||
46 | name: certreload | ||
47 | vars: | ||
48 | certreload: | ||
49 | notifiers: | ||
50 | - reload postfix | ||