1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
8 - name: install postfix
15 ignore_errors: "{{ignore_online_errors | bool}}"
18 - name: add postfix user to groups mail,sasl,ssl-cert,letsencrypt,opendkim,opendmarc
21 groups: "mail,sasl,ssl-cert,letsencrypt,opendkim,opendmarc,pyspf-milter"
30 dest: "/etc/postfix/main.cf"
35 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/main.cf"
36 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/main.cf"
37 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/main.cf"
39 notify: restart postfix.service
42 - name: copy master.cf
45 dest: "/etc/postfix/master.cf"
50 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/master.cf"
51 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/master.cf"
52 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/master.cf"
54 notify: restart postfix.service
57 - name: copy saslauthd smtpd.conf
60 dest: "/etc/postfix/sasl/smtpd.conf"
65 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sasl.smtpd.conf"
66 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sasl.smtpd.conf"
67 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sasl.smtpd.conf"
68 - "default/sasl.smtpd.conf"
69 notify: restart postfix.service
72 - name: copy header_checks_in.regexp
75 dest: "/etc/postfix/header_checks_in.regexp"
80 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/header_checks_in.regexp"
81 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/header_checks_in.regexp"
82 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/header_checks_in.regexp"
83 - "default/header_checks_in.regexp"
84 notify: reload postfix.service
87 - name: copy header_checks_out.regexp
90 dest: "/etc/postfix/header_checks_out.regexp"
95 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/header_checks_out.regexp"
96 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/header_checks_out.regexp"
97 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/header_checks_out.regexp"
98 - "default/header_checks_out.regexp"
99 notify: reload postfix.service
102 - name: copy rcpt_recipient.regexp
105 dest: "/etc/postfix/rcpt_recipient.regexp"
110 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/rcpt_recipient.regexp"
111 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/rcpt_recipient.regexp"
112 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/rcpt_recipient.regexp"
113 - "default/rcpt_recipient.regexp"
114 notify: reload postfix.service
117 - name: copy rcpt_sender.regexp
120 dest: "/etc/postfix/rcpt_sender.regexp"
125 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/rcpt_sender.regexp"
126 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/rcpt_sender.regexp"
127 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/rcpt_sender.regexp"
128 - "default/rcpt_sender.regexp"
129 notify: reload postfix.service
132 - name: copy rel_recipient.regexp
135 dest: "/etc/postfix/rel_recipient.regexp"
140 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/rel_recipient.regexp"
141 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/rel_recipient.regexp"
142 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/rel_recipient.regexp"
143 - "default/rel_recipient.regexp"
144 notify: reload postfix.service
147 - name: copy rel_sender.regexp
150 dest: "/etc/postfix/rel_sender.regexp"
155 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/rel_sender.regexp"
156 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/rel_sender.regexp"
157 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/rel_sender.regexp"
158 - "default/rel_sender.regexp"
159 notify: reload postfix.service
162 - name: copy transport.map
165 dest: "/etc/postfix/transport.map"
170 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/transport.map"
171 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/transport.map"
172 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/transport.map"
173 - "default/transport.map"
174 notify: rehash postfix maps
177 - name: copy virtual.map
180 dest: "/etc/postfix/virtual.map"
185 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/virtual.map"
186 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/virtual.map"
187 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/virtual.map"
188 - "default/virtual.map"
189 notify: rehash postfix maps
192 - name: copy postfix@.service to /etc/systemd/system/
195 dest: "/etc/systemd/system/postfix@.service"
200 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/postfix@.service"
201 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/postfix@.service"
202 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/postfix@.service"
203 - "default/postfix@.service"
206 - name: enable and start postfix.service
207 include_role: name="base/systemd/enable-and-start"
209 service_name: postfix.service