62b20547f876bc9cfe7edaa27028cb3fad7e7441
[ansible.git] / roles / postfix / tasks / postfix.yml
1 - name: install postfix
2   apt: name=postfix,bsd-mailx state=latest
3 - name: install postfix-mysql
4   when: postfix.vmail_mysql_password is defined
5   apt: name=postfix-mysql state=latest
6 - name: enable postfix
7   service: name=postfix enabled=yes
8 # config
9 - name: install postfix config
10   template:
11     dest: /etc/postfix/{{ item }}
12     src: templates/{{ item }}
13   loop:
14   - main.cf
15   - master.cf
16   notify: postfix
17 - name: install postfix mysql config
18   when: postfix.vmail_mysql_password is defined
19   template:
20     dest: /etc/postfix/{{ item }}
21     src: templates/{{ item }}
22     mode: u=rw,g=r,o=
23     group: postfix
24   loop:
25   - mysql_vmail_aliases.cf
26   - mysql_vmail_senders.cf
27   - mysql_vmail_users.cf
28   notify: postfix
29 - name: create empty maps
30   when: postfix.virtual_mailbox_domains is defined
31   copy:
32     dest: /etc/postfix/{{ item }}
33     content: ""
34     force: no
35   loop:
36   - virtual_alias_map
37   - transport_map
38 - name: give postfix user access to opendkim
39   when: postfix.opendkim is defined
40   user:
41     name: postfix
42     groups: opendkim
43     append: yes
44   notify: postfix
45 # cronjobs
46 - name: delete old local-mail cronjob
47   file: path=/etc/cron.daily/local-mail state=absent
48 - name: install check-for-local-mail cronjob
49   copy:
50     dest: /etc/cron.daily/check-for-local-mail
51     src: files/check-for-local-mail
52     mode: u=rwx,g=rx,o=rx
53 - name: install mailman-check cronjob
54   when: postfix.mailman is defined and postfix.mailman
55   copy:
56     dest: /etc/cron.daily/mailman-check
57     src: files/mailman-check
58     mode: u=rwx,g=rx,o=rx
59 - name: remove mailman-check cronjob
60   when: not (postfix.mailman is defined and postfix.mailman)
61   file:
62     path: /etc/cron.daily/mailman-check
63     state: absent
64 # tools
65 - block:
66   - name: create newmail dir
67     file: path=/root/newmail state=directory
68   - name: install newmail script
69     copy:
70       dest: /root/newmail/newmail
71       src: files/newmail/newmail
72       mode: u=rwx,g=rx,o=rx
73   - name: install newmail templates
74     copy:
75       dest: /root/newmail/templates.py
76       src: files/newmail/templates.py
77   when: postfix.vmail_mysql_password is defined