-
Notifications
You must be signed in to change notification settings - Fork 681
/
install_postfix.yml
69 lines (62 loc) · 1.53 KB
/
install_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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
- name: Install mailing utilities.
apt:
pkg: "{{ postfix_dependencies }}"
state: present
tags:
- apt
- postfix
- name: Copy postfix /etc/aliases file to route root mail alerts to OSSEC.
copy:
src: aliases
dest: /etc/aliases
notify: update aliases
tags:
- postfix
- name: Create outbound mapping for postfix_from_address in /etc/postfix/generic.
copy:
content: "ossec@{{ postfix_hostname }} {{ postfix_from_address }}\n"
dest: /etc/postfix/generic
notify: update generic_maps
when: postfix_from_address != ""
tags:
- postfix
- name: Remove /etc/postfix/generic database because postfix_from_address is empty.
file:
state: absent
dest: "{{ item }}"
with_items:
- /etc/postfix/generic
- /etc/postfix/generic.db
when: postfix_from_address == ""
tags:
- postfix
- name: Configure SASL password for SMTP relay.
template:
src: sasl_passwd
dest: /etc/postfix/sasl_passwd
mode: "0400"
notify: update sasl_passwd db
tags:
- postfix
- permissions
- name: Configure Postfix to strip SMTP headers.
copy:
src: header_checks
dest: /etc/postfix/header_checks
notify: postmap_header_checks
tags:
- postfix
- hardening
- name: Copy Postfix config file.
template:
src: main.cf
dest: /etc/postfix/main.cf
notify: restart postfix
tags:
- postfix
- name: Configure Postfix service.
service:
name: postfix
state: "{{ 'started' if postfix_enable_service else 'stopped' }}"
enabled: "{{ postfix_enable_service }}"