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 transport_map
50 when: postfix.virtual_mailbox_domains is defined
51 register: transport_map
53 dest: /etc/postfix/transport_map
54 src: templates/transport_map
55 - name: postmap transport_map
56 when: transport_map.changed
57 command: postmap /etc/postfix/transport_map
60 - name: delete old local-mail cronjob
61 file: path=/etc/cron.daily/local-mail state=absent
62 - name: install check-for-local-mail cronjob
64 dest: /etc/cron.daily/check-for-local-mail
65 src: files/check-for-local-mail
67 - name: install mailman-check cronjob
68 when: postfix.mailman is defined and postfix.mailman
70 dest: /etc/cron.daily/mailman-check
71 src: files/mailman-check
73 - name: remove mailman-check cronjob
74 when: not (postfix.mailman is defined and postfix.mailman)
76 path: /etc/cron.daily/mailman-check
80 - name: create newmail dir
81 file: path=/root/newmail state=directory
82 - name: install newmail script
84 dest: /root/newmail/newmail
85 src: files/newmail/newmail
87 - name: install newmail templates
89 dest: /root/newmail/templates.py
90 src: files/newmail/templates.py
91 when: postfix.dovecot is defined