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 }}
16 - postscreen_access.cidr
18 - name: install postfix mysql config
19 when: postfix.dovecot is defined
21 dest: /etc/postfix/{{ item }}
22 src: templates/{{ item }}
26 - mysql_vmail_aliases.cf
27 - mysql_vmail_senders.cf
28 - mysql_vmail_users.cf
30 - name: give postfix user access to opendkim
31 # we assume the user alredy exists (it is created above by installing postfix)
32 when: postfix.opendkim is defined
39 - name: create empty virtual_alias_map
40 register: virtual_alias_map
42 dest: /etc/postfix/virtual_alias_map
45 - name: postmap virtual_alias_map
46 when: virtual_alias_map.changed
47 command: postmap /etc/postfix/virtual_alias_map
49 - name: create sender_transport_map
50 when: postfix.smtp_outgoing is defined
51 register: sender_transport_map
53 dest: /etc/postfix/sender_transport_map
54 src: templates/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: install check-for-local-mail cronjob
81 dest: /etc/cron.daily/check-for-local-mail
82 src: files/check-for-local-mail