1 - name: install postfix
2 apt: name=postfix,bsd-mailx state=latest
3 - name: install postfix-mysql
4 when: postfix.dovecot is defined
5 apt: name=postfix-mysql state=latest
7 service: name=postfix enabled=yes
9 - name: install postfix config
11 dest: /etc/postfix/{{ item }}
12 src: templates/{{ item }}
17 - name: install postfix mysql config
18 when: postfix.dovecot is defined
20 dest: /etc/postfix/{{ item }}
21 src: templates/{{ item }}
25 - mysql_vmail_aliases.cf
26 - mysql_vmail_senders.cf
27 - mysql_vmail_users.cf
29 - name: give postfix user access to opendkim
30 # we assume the user alredy exists (it is created above by installing postfix)
31 when: postfix.opendkim is defined
38 - name: create empty virtual_alias_map
39 register: virtual_alias_map
41 dest: /etc/postfix/virtual_alias_map
44 - name: postmap virtual_alias_map
45 when: virtual_alias_map.changed
46 command: postmap /etc/postfix/virtual_alias_map
48 - name: create empty sender_transport_map
49 when: postfix.smtp_outgoing is defined
50 register: sender_transport_map
52 dest: /etc/postfix/sender_transport_map
55 - name: postmap sender_transport_map
56 when: sender_transport_map.changed
57 command: postmap /etc/postfix/sender_transport_map
59 - name: create relay_clientcerts
60 when: postfix.relay_client_cert_whitelist is defined
61 register: relay_clientcerts
63 dest: /etc/postfix/relay_clientcerts
64 src: templates/relay_clientcerts
65 - name: postmap relay_clientcerts
66 when: relay_clientcerts.changed
67 command: postmap /etc/postfix/relay_clientcerts
69 - name: create transport_map
70 register: transport_map
72 dest: /etc/postfix/transport_map
73 src: templates/transport_map
74 - name: postmap transport_map
75 when: transport_map.changed
76 command: postmap /etc/postfix/transport_map
79 - name: delete old local-mail cronjob
80 file: path=/etc/cron.daily/local-mail state=absent
81 - name: install check-for-local-mail cronjob
83 dest: /etc/cron.daily/check-for-local-mail
84 src: files/check-for-local-mail