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 sender_transport_map
49 when: postfix.smtp_outgoing is defined
50 register: sender_transport_map
52 dest: /etc/postfix/sender_transport_map
53 src: templates/sender_transport_map
54 - name: postmap sender_transport_map
55 when: sender_transport_map.changed
56 command: postmap /etc/postfix/sender_transport_map
58 - name: create relay_clientcerts
59 when: postfix.relay_client_cert_whitelist is defined
60 register: relay_clientcerts
62 dest: /etc/postfix/relay_clientcerts
63 src: templates/relay_clientcerts
64 - name: postmap relay_clientcerts
65 when: relay_clientcerts.changed
66 command: postmap /etc/postfix/relay_clientcerts
68 - name: create transport_map
69 register: transport_map
71 dest: /etc/postfix/transport_map
72 src: templates/transport_map
73 - name: postmap transport_map
74 when: transport_map.changed
75 command: postmap /etc/postfix/transport_map
78 - name: delete old local-mail cronjob
79 file: path=/etc/cron.daily/local-mail state=absent
80 - name: install check-for-local-mail cronjob
82 dest: /etc/cron.daily/check-for-local-mail
83 src: files/check-for-local-mail