Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
main.yml 2.46 KiB
---
- 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:
    - aliases
    - milter_header_checks
  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

- name: open firewall holes for postfix
  ansible.posix.firewalld: service=smtp zone={{ item }} permanent=true state=enabled immediate=yes
  loop:
    -
    - wireguard
  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

- 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

- 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

- name: start and enable mailman{.service,-*.timer}
  systemd: name={{ item }} enabled=yes daemon_reload=yes state=started
  loop:
    - mailman.service