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 empty relay_clientcerts
64 when: postfix.relay_client_cert_whitelist is defined
65 register: relay_clientcerts
67 dest: /etc/postfix/relay_clientcerts
70 - name: postmap relay_clientcerts
71 when: relay_clientcerts.changed
72 command: postmap /etc/postfix/relay_clientcerts
74 - name: create transport_map
75 when: postfix.virtual_mailbox_domains is defined
76 register: transport_map
78 dest: /etc/postfix/transport_map
79 src: templates/transport_map
80 - name: postmap transport_map
81 when: transport_map.changed
82 command: postmap /etc/postfix/transport_map
85 - name: delete old local-mail cronjob
86 file: path=/etc/cron.daily/local-mail state=absent
87 - name: install check-for-local-mail cronjob
89 dest: /etc/cron.daily/check-for-local-mail
90 src: files/check-for-local-mail
92 - name: install mailman-check cronjob
93 when: postfix.mailman is defined and postfix.mailman
95 dest: /etc/cron.daily/mailman-check
96 src: files/mailman-check
98 - name: remove mailman-check cronjob
99 when: not (postfix.mailman is defined and postfix.mailman)
101 path: /etc/cron.daily/mailman-check
105 - name: create newmail dir
106 file: path=/root/newmail state=directory
107 - name: install newmail script
109 dest: /root/newmail/newmail
110 src: files/newmail/newmail
111 mode: u=rwx,g=rx,o=rx
112 - name: install newmail templates
114 dest: /root/newmail/templates.py
115 src: files/newmail/templates.py
116 when: postfix.dovecot is defined