main.yml 2.62 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
- name: create ssl cert
  include_role:
    name: certificate
  vars:
    domains: ["{{ lists_domain }}"]

- name: install mailman, uwsgi-plugin-cgi and postfx
  pacman: name=mailman,uwsgi-plugin-cgi,postfix,postfix-pcre state=present

- name: install mailman configuration
  template: src=mm_cfg.py.j2 dest=/etc/mailman/mm_cfg.py follow=yes owner=root group=root mode=0644
  notify: reload mailman

- name: install postfix configuration
  template: src=main.cf.j2 dest=/etc/postfix/main.cf owner=root group=root mode=0644
  notify: reload postfix

- name: install postfix maps
  copy: src={{ item }} dest=/etc/postfix/ owner=root group=root mode=0644
  loop:
22
    - aliases
23
    - milter_header_checks
Kristian Klausen's avatar
Kristian Klausen committed
24
25
26
27
28
29
30
  notify: run postmap

- name: install postfix templated maps
  template: src={{ item }}.j2 dest=/etc/postfix/{{ item }} owner=root group=root mode=0644
  loop:
    - transport
  notify: run postmap
31
32

- name: open firewall holes for postfix
Kristian Klausen's avatar
Kristian Klausen committed
33
34
35
36
  ansible.posix.firewalld: service=smtp zone={{ item }} permanent=true state=enabled immediate=yes
  loop:
    -
    - wireguard
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  when: configure_firewall
  tags:
    - firewall

- name: create mailman list
  command: /usr/lib/mailman/bin/newlist -a mailman root@{{ lists_domain }} meG0n5Wq6dEWCA6s
  args:
    creates: /var/lib/mailman/lists/mailman

- name: configure mailman uwsgi service
  copy: src=mailman.ini dest=/etc/uwsgi/vassals/ owner=mailman group=http mode=0644

- name: make nginx log dir
  file: path=/var/log/nginx/{{ lists_domain }} state=directory owner=root group=root mode=0755

52
53
54
55
- name: install nginx mailman2->mailman3 redirect map
  copy: src=migrated-lists.map dest=/etc/nginx/maps/ owner=root group=root mode=0644
  notify: reload nginx

56
57
58
59
60
61
62
63
- name: set up nginx
  template: src=nginx.d.conf.j2 dest="/etc/nginx/nginx.d/mailman.conf" owner=root group=root mode=644
  notify: reload nginx
  tags: ['nginx']

- name: start and enable postfix
  systemd: name=postfix.service enabled=yes daemon_reload=yes state=started

64
65
66
67
68
69
70
- name: create drop-in directory for mailman.service
  file: path=/etc/systemd/system/mailman.service.d state=directory owner=root group=root mode=0755

- name: install drop-in for mailman.service
  copy: src=override.conf dest=/etc/systemd/system/mailman.service.d/ owner=root group=root mode=0644
  notify: restart mailman

71
72
73
74
75
76
77
78
79
80
81
- name: start and enable mailman{.service,-*.timer}
  systemd: name={{ item }} enabled=yes daemon_reload=yes state=started
  loop:
    - mailman.service
    - mailman-senddigests.timer
    - mailman-nightlygzip.timer
    - mailman-mailpasswds.timer
    - mailman-gatenews.timer
    - mailman-disabled.timer
    - mailman-cullbadshunt.timer
    - mailman-checkdbs.timer