1 - name: install postfix
2 apt: name=postfix,bsd-mailx state=latest
3 - name: install postfix-mysql
4 apt: name=postfix-mysql state=latest
5 when: postfix.vmail_mysql_password is defined
6 - name: install postfix config
7 register: postfix_config
9 dest: /etc/postfix/{{ item }}
10 src: templates/{{ item }}
14 - name: install postfix mysql config
15 register: postfix_mysql
17 dest: /etc/postfix/{{ item }}
18 src: templates/{{ item }}
22 - mysql_vmail_aliases.cf
23 - mysql_vmail_senders.cf
24 - mysql_vmail_users.cf
25 when: postfix.vmail_mysql_password is defined
26 - name: create empty maps
28 dest: /etc/postfix/{{ item }}
34 when: postfix.virtual_mailbox_domains is defined
35 - name: reload postfix
36 service: name=postfix state=restarted enabled=yes
37 when: postfix_config.changed or postfix_mysql.changed
38 - name: delete old local-mail cronjob
39 file: path=/etc/cron.daily/local-mail state=absent
40 - name: install check-for-local-mail cronjob
42 dest: /etc/cron.daily/check-for-local-mail
43 src: files/check-for-local-mail