main.yml 2.39 KB
Newer Older
Hinrikus Wolf's avatar
Hinrikus Wolf committed
1
2
---

3
4
5
6
7
8
9
- name: "include tls config vars (preset: {{ postfix_tls_configuration }})"
  include_vars:
    file: "tls-{{ postfix_tls_configuration }}.yml"
  tags:
    - postfix
    - mail

Hinrikus Wolf's avatar
Hinrikus Wolf committed
10
- name: ensure all required postfix packages are installed
Lars Beckers's avatar
Lars Beckers committed
11
  apt:
12
13
14
15
    name:
      - postfix
      - postfix-pcre
      - postfix-cdb
Lars Beckers's avatar
Lars Beckers committed
16
    state: present
Lars Beckers's avatar
Lars Beckers committed
17
  tags:
Hinrikus Wolf's avatar
Hinrikus Wolf committed
18
19
20
    - postfix
    - mail

Lars Beckers's avatar
Lars Beckers committed
21
22
23
24
25
- name: ensure additional packages are installed if required
  apt:
    name: memcached
    state: present
  when: postfix_enable_memcached
Hinrikus Wolf's avatar
Hinrikus Wolf committed
26
27
28
29
  tags:
    - postfix
    - mail

Lars Beckers's avatar
Lars Beckers committed
30
31
32
33
- name: ensure config is present
  template:
    src: "{{ item }}.j2"
    dest: "/etc/postfix/{{ item }}"
Hinrikus Wolf's avatar
Hinrikus Wolf committed
34
  with_items:
Lars Beckers's avatar
Lars Beckers committed
35
    - login_maps.pcre
36
    - master.cf
37
    - main.cf
Lars Beckers's avatar
Lars Beckers committed
38
    - postscreen_access.cidr
Lars Beckers's avatar
Lars Beckers committed
39
  notify:
Hinrikus Wolf's avatar
Hinrikus Wolf committed
40
    - restart postfix
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  tags:
    - postfix
    - mail

- name: ensure dh params are available
  copy:
    src: "{{ postfix_tls_dh_file }}"
    dest: /etc/postfix/dh.pem
    owner: root
    group: root
    mode: '0644'
  when: postfix_tls_dh_file is string
  notify:
    - restart postfix
Hinrikus Wolf's avatar
Hinrikus Wolf committed
55
56
57
  tags:
    - postfix
    - mail
58
59

- name: ensure memcached config is present
Lars Beckers's avatar
Lars Beckers committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  template:
    src: memcached.conf.j2
    dest: /etc/memcached.conf
  when: postfix_enable_memcached
  notify:
    - restart memcached
  tags:
    - postfix
    - mail

- name: ensure postscreen memcached integration is present
  template:
    src: postscreen_cache.j2
    dest: /etc/postfix/postscreen_cache
  when: postfix_enable_memcached
75
76
77
78
79
  notify:
    - restart memcached
  tags:
    - postfix
    - mail
Lars Beckers's avatar
Lars Beckers committed
80

81
82
- import_tasks: mta-sts.yml

83
84
85
86
87
88
89
90
91
- name: install rt-mailgate if needed
  apt:
    name: rt4-clients
    state: present
  when: postfix_aliases_rt|bool
  tags:
    - postfix
    - mail

92
- name: ensure system alias database is present
Lars Beckers's avatar
Lars Beckers committed
93
94
95
  template:
    src: aliases.j2
    dest: /etc/aliases
96
97
98
99
100
101
102
  notify:
    - postmap system
  tags:
    - postfix
    - mail

- name: ensure virtual alias database is present
Lars Beckers's avatar
Lars Beckers committed
103
104
105
  template:
    src: virtual.j2
    dest: /etc/postfix/virtual
106
107
108
109
110
  notify:
    - postmap virtual
  tags:
    - postfix
    - mail
Hinrikus Wolf's avatar
Hinrikus Wolf committed
111

Lars Beckers's avatar
Lars Beckers committed
112
113
114
115
116
117
118
119
120
- name: ensure mailname is properly configured
  template:
    src: mailname.j2
    dest: /etc/mailname
  notify:
    - restart postfix
  tags:
    - postfix
    - mail
121
122
123
124
125
126
127
128
129
130
131

- name: ensure transport_maps are configured
  template:
    src: transport.j2
    dest: /etc/postfix/transport
  notify:
    - postmap transport
  when: postfix_transport_maps|bool
  tags:
    - postfix
    - mail