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