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 when: postfix.virtual_mailbox_domains is defined
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 empty sender_transport_map
50 when: postfix.smtp_outgoing is defined
51 register: sender_transport_map
53 dest: /etc/postfix/sender_transport_map
56 - name: postmap sender_transport_map
57 when: sender_transport_map.changed
58 command: postmap /etc/postfix/sender_transport_map
60 - name: create relay_clientcerts
61 when: postfix.relay_client_cert_whitelist is defined
62 register: relay_clientcerts
64 dest: /etc/postfix/relay_clientcerts
65 src: templates/relay_clientcerts
66 - name: postmap relay_clientcerts
67 when: relay_clientcerts.changed
68 command: postmap /etc/postfix/relay_clientcerts
70 - name: create transport_map
71 when: postfix.virtual_mailbox_domains is defined
72 register: transport_map
74 dest: /etc/postfix/transport_map
75 src: templates/transport_map
76 - name: postmap transport_map
77 when: transport_map.changed
78 command: postmap /etc/postfix/transport_map
81 - name: delete old local-mail cronjob
82 file: path=/etc/cron.daily/local-mail state=absent
83 - name: install check-for-local-mail cronjob
85 dest: /etc/cron.daily/check-for-local-mail
86 src: files/check-for-local-mail
90 - name: create newmail dir
91 file: path=/root/newmail state=directory
92 - name: install newmail script
94 dest: /root/newmail/newmail
95 src: files/newmail/newmail
97 - name: install newmail templates
99 dest: /root/newmail/templates.py
100 src: files/newmail/templates.py
101 when: postfix.dovecot is defined