]> arthur.barton.de Git - AnsibleRoles.git/blob - roles/postfix/tasks/main.yml
de015fe50e7cb8f6421bff9da19d6dfd86580764
[AnsibleRoles.git] / roles / postfix / tasks / main.yml
1 ---
2 # postfix tasks
3
4 # Make sure settings in /etc/postfix/main.cf are the same than for debconf!
5
6 - name: set other destinations to accept mail for (main.cf)
7   tags:
8     - mail
9     - postfix
10   lineinfile: >
11     dest=/etc/postfix/main.cf
12     line="mydestination = {{ postfix_destinations }}"
13     regexp="^mydestination"
14   notify:
15     - restart "postfix"
16
17 - name: set local networks (main.cf)
18   tags:
19     - mail
20     - postfix
21   lineinfile: >
22     dest=/etc/postfix/main.cf
23     line="mynetworks = {{ postfix_local_networks }}"
24     regexp="^mynetworks"
25   notify:
26     - restart "postfix"
27
28 - name: set internet protocols to use (main.cf)
29   tags:
30     - mail
31     - postfix
32   lineinfile: >
33     dest=/etc/postfix/main.cf
34     line="inet_protocols = {{ postfix_protocols }}"
35     regexp="^inet_protocols"
36   notify:
37     - restart "postfix"
38
39 # Debconf
40
41 - name: 'debconf(1): configure Postfix as "Satellite system"'
42   tags:
43     - debconf
44     - mail
45     - postfix
46   debconf: >
47     name=postfix
48     question=postfix/main_mailer_type
49     value="Satellite system"
50     vtype=select
51   notify:
52     - update "postfix" configuration
53
54 - name: 'debconf(1): set system mail name'
55   tags:
56     - debconf
57     - mail
58     - postfix
59   debconf: >
60     name=postfix
61     question=postfix/mailname
62     value="{{ postfix_mailname }}"
63     vtype=string
64   notify:
65     - update "postfix" configuration
66
67 - name: 'debconf(1): set SMTP relay host'
68   tags:
69     - debconf
70     - mail
71     - postfix
72   debconf: >
73     name=postfix
74     question=postfix/relayhost
75     value="{{ smtp_relay_host }}"
76     vtype=string
77   notify:
78     - update "postfix" configuration
79
80 - name: 'debconf(1): set root and postmaster recipient'
81   tags:
82     - debconf
83     - mail
84     - postfix
85   debconf: >
86     name=postfix
87     question=postfix/root_address
88     value="{{ postfix_root_address }}"
89     vtype=string
90   notify:
91     - update "postfix" configuration
92
93 - name: 'debconf(1): set other destinations to accept mail for'
94   tags:
95     - debconf
96     - mail
97     - postfix
98   debconf: >
99     name=postfix
100     question=postfix/destinations
101     value="{{ postfix_destinations }}"
102     vtype=string
103   notify:
104     - update "postfix" configuration
105
106 - name: 'debconf(1): set local networks'
107   tags:
108     - debconf
109     - mail
110     - postfix
111   debconf: >
112     name=postfix
113     question=postfix/mynetworks
114     value="{{ postfix_local_networks }}"
115     vtype=string
116   notify:
117     - update "postfix" configuration
118
119 - name: 'debconf(1): set mailbox size limit'
120   tags:
121     - debconf
122     - mail
123     - postfix
124   debconf: >
125     name=postfix
126     question=postfix/mailbox_limit
127     value="{{ postfix_mailbox_limit }}"
128     vtype=string
129   notify:
130     - update "postfix" configuration
131
132 - name: 'debconf(1): set local address extension character'
133   tags:
134     - debconf
135     - mail
136     - postfix
137   debconf: >
138     name=postfix
139     question=postfix/recipient_delim
140     value="{{ postfix_recipient_delim }}"
141     vtype=string
142   notify:
143     - update "postfix" configuration
144
145 - name: 'debconf(1): set internet protocols to use'
146   tags:
147     - debconf
148     - mail
149     - postfix
150   debconf: >
151     name=postfix
152     question=postfix/protocols
153     value="{{ postfix_protocols }}"
154     vtype=select
155   notify:
156     - update "postfix" configuration
157
158 - name: 'debconf(1): configure synchronous updates on mail queue'
159   tags:
160     - debconf
161     - mail
162     - postfix
163   debconf: >
164     name=postfix
165     question=postfix/chattr
166     value="{{ postfix_sync_updates }}"
167     vtype=boolean
168   notify:
169     - update "postfix" configuration
170
171 - name: install "postfix" package
172   tags:
173     - mail
174     - packages
175     - postfix
176   apt: >
177     state=installed
178     name=postfix
179
180 - name: setup "/etc/mailname"
181   tags:
182     - mail
183     - postfix
184   template: >
185     dest=/etc/mailname
186     group=root
187     mode=0644
188     owner=root
189     src=mailname.j2
190   notify:
191     - restart "postfix"
192
193 - name: set Posfix "myorigin"
194   tags:
195     - mail
196     - postfix
197   lineinfile: >
198     dest=/etc/postfix/main.cf
199     group=root
200     line="myorigin = /etc/mailname"
201     mode=0644
202     owner=root
203     regexp="^myorigin"
204   notify:
205     - restart "postfix"
206
207 - name: set Posfix "inet_interfaces"
208   tags:
209     - mail
210     - postfix
211   lineinfile: >
212     dest=/etc/postfix/main.cf
213     line="inet_interfaces = {{ postfix_interfaces }}"
214     regexp="^inet_interfaces"
215   notify:
216     - restart "postfix"
217
218 - name: ensure service "postfix" is enabled and started
219   tags:
220     - mail
221     - postfix
222     - services
223   service: >
224     enabled=yes
225     name=postfix
226     state=started