patch mailman to add a simple question-and-answer CAPTCHA
[ansible.git] / roles / email / tasks / mailman.yml
1 - name: install mailman
2   apt: name=mailman state=latest
3 - name: configure mailman
4   template:
5     dest: /etc/mailman/mm_cfg.py
6     src: templates/mm_cfg.py
7   notify: mailman
8 - name: install mailman-check cronjob
9   copy:
10     dest: /etc/cron.daily/mailman-check
11     src: files/mailman-check
12     mode: u=rwx,g=rx,o=rx
13 # the CAPTCHA patch (and some template modifications)
14 - name: check if the files are already patched
15   shell: 'fgrep MAILMAN_CAPTCHA_PATCHED Cgi/listinfo.py && fgrep MAILMAN_CAPTCHA_PATCHED Cgi/subscribe.py'
16   args:
17     chdir: /usr/lib/mailman/Mailman
18   changed_when: False
19   register: mailman_patched
20 - name: check if all the files have the right checksums to be patched
21   shell: 'echo "{{item}}" | sha256sum -c'
22   loop:
23     - "26b4cbb7c5bde8badf741e31975235e74abb932037d77d862cf00b412726c2c2  /usr/lib/mailman/Mailman/Cgi/listinfo.py"
24     - "cbef3d8cb6b65e4c9b2462f8627966d55dd52caa2e626c87241c4f8d47477dc7  /usr/lib/mailman/Mailman/Cgi/subscribe.py"
25   changed_when: False
26   when: mailman_patched.rc != 0
27 - name: install patched python files
28   copy:
29     dest: /usr/lib/mailman/Mailman/{{item}}
30     src: files/mailman-patched/{{item}}
31   loop:
32   - Cgi/listinfo.py
33   - Cgi/subscribe.py
34   - Captcha.py
35 - name: install patched templates
36   copy:
37     dest: /etc/mailman/{{item}}
38     src: files/mailman-patched/{{item}}
39   loop:
40   - de/listinfo.html
41   - en/listinfo.html