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
8 - name: install mailman
9 when: postfix.mailman is defined and postfix.mailman
10 apt: name=mailman state=latest
12 - name: install postfix config
14 dest: /etc/postfix/{{ item }}
15 src: templates/{{ item }}
20 - name: install postfix mysql config
21 when: postfix.dovecot is defined
23 dest: /etc/postfix/{{ item }}
24 src: templates/{{ item }}
28 - mysql_vmail_aliases.cf
29 - mysql_vmail_senders.cf
30 - mysql_vmail_users.cf
32 - name: give postfix user access to opendkim
33 # we assume the user alredy exists (it is created above by installing postfix)
34 when: postfix.opendkim is defined
41 - name: create empty virtual_alias_map
42 when: postfix.virtual_mailbox_domains is defined
43 register: virtual_alias_map
45 dest: /etc/postfix/virtual_alias_map
48 - name: postmap virtual_alias_map
49 when: virtual_alias_map.changed
50 command: postmap /etc/postfix/virtual_alias_map
52 - name: create empty sender_transport_map
53 when: postfix.smtp_outgoing is defined
54 register: sender_transport_map
56 dest: /etc/postfix/sender_transport_map
59 - name: postmap sender_transport_map
60 when: sender_transport_map.changed
61 command: postmap /etc/postfix/sender_transport_map
63 - name: create relay_clientcerts
64 when: postfix.relay_client_cert_whitelist is defined
65 register: relay_clientcerts
67 dest: /etc/postfix/relay_clientcerts
68 src: templates/relay_clientcerts
69 - name: postmap relay_clientcerts
70 when: relay_clientcerts.changed
71 command: postmap /etc/postfix/relay_clientcerts
73 - name: create transport_map
74 when: postfix.virtual_mailbox_domains is defined
75 register: transport_map
77 dest: /etc/postfix/transport_map
78 src: templates/transport_map
79 - name: postmap transport_map
80 when: transport_map.changed
81 command: postmap /etc/postfix/transport_map
84 - name: delete old local-mail cronjob
85 file: path=/etc/cron.daily/local-mail state=absent
86 - name: install check-for-local-mail cronjob
88 dest: /etc/cron.daily/check-for-local-mail
89 src: files/check-for-local-mail
91 - name: install mailman-check cronjob
92 when: postfix.mailman is defined and postfix.mailman
94 dest: /etc/cron.daily/mailman-check
95 src: files/mailman-check
97 - name: remove mailman-check cronjob
98 when: not (postfix.mailman is defined and postfix.mailman)
100 path: /etc/cron.daily/mailman-check
104 - name: create newmail dir
105 file: path=/root/newmail state=directory
106 - name: install newmail script
108 dest: /root/newmail/newmail
109 src: files/newmail/newmail
110 mode: u=rwx,g=rx,o=rx
111 - name: install newmail templates
113 dest: /root/newmail/templates.py
114 src: files/newmail/templates.py
115 when: postfix.dovecot is defined