system-config/playbooks/roles/mailman-site/tasks/main.yaml
Clark Boylan 6c115cf29e Add support for Ubuntu Focal to our mailman ansible
This switch testing of lists.openstack.org to Focal and we make a CGI
env var update to accomodate newer mailman.

Specifically newer mailman's CGI scripts filter env vars that it will
pass through. We were setting MAILMAN_SITE_DIR to vhost our mailman
installs with apache2, but that doesn't pass the filter and is removed.
HOST is passed through so we update our scripts, apache vhost configs,
exim, and init scripts to use the HOST env var instead.

Change-Id: I5c8c70c219669e37b7b75a61001a2b7f7bb0bb6c
2021-09-13 09:10:00 -07:00

113 lines
3.1 KiB
YAML

- name: Set mailman site root fact
set_fact:
mm_site_root: "/srv/mailman/{{ mailman_site.name }}"
cacheable: no
- name: Create mm site dirs
file:
path: "{{ inner_site_dir }}"
state: directory
owner: list
group: list
mode: '2775'
loop:
- "{{ mm_site_root }}/"
- "{{ mm_site_root }}/etc"
- "{{ mm_site_root }}/lists"
- "{{ mm_site_root }}/logs"
- "{{ mm_site_root }}/locks"
- "{{ mm_site_root }}/data"
- "{{ mm_site_root }}/spam"
- "{{ mm_site_root }}/mail"
- "{{ mm_site_root }}/run"
- "{{ mm_site_root }}/archives"
- "{{ mm_site_root }}/archives/public"
- "{{ mm_site_root }}/archives/private"
- "{{ mm_site_root }}/templates"
- "{{ mm_site_root }}/qfiles"
- "{{ mm_site_root }}/qfiles/in"
- "{{ mm_site_root }}/qfiles/out"
- "{{ mm_site_root }}/qfiles/commands"
- "{{ mm_site_root }}/qfiles/bounces"
- "{{ mm_site_root }}/qfiles/news"
- "{{ mm_site_root }}/qfiles/archive"
- "{{ mm_site_root }}/qfiles/shunt"
- "{{ mm_site_root }}/qfiles/virgin"
- "{{ mm_site_root }}/qfiles/bad"
- "{{ mm_site_root }}/qfiles/retry"
- "{{ mm_site_root }}/qfiles/maildir"
loop_control:
loop_var: inner_site_dir
- name: Link html templates into site
file:
state: link
src: "/usr/share/mailman/{{ site_language }}"
dest: "{{ mm_site_root }}/templates/{{ site_language }}"
owner: root
group: root
loop: "{{ mailman_site.install_languages }}"
loop_control:
loop_var: site_language
- name: Create openstack specific en templates dir
file:
state: directory
path: /srv/mailman/openstack/templates/en
owner: root
group: list
mode: '0755'
when: mailman_site.name == "openstack"
- name: Copy openstack specific en templates into site
synchronize:
src: openstack/html-templates-en/
dest: /srv/mailman/openstack/templates/en
rsync_opts:
- "--usermap=*:root"
- "--groupmap=*:list"
when: mailman_site.name == "openstack"
- name: Create site specific config
template:
src: mm_site_cfg.py.j2
dest: "{{ mm_site_root }}/etc/mm_cfg_local.py"
owner: root
group: root
mode: '0444'
- name: Create normal mailman vhost config
template:
src: mailman_multihost.vhost.j2
dest: "/etc/apache2/sites-enabled/50-{{ mailman_site.listdomain }}.conf"
owner: root
group: root
mode: '0644'
notify: mailman site reload apache2
- name: Create site init script
template:
src: mailman.init.j2
dest: "/etc/init.d/mailman-{{ mailman_site.name }}"
owner: root
group: root
mode: '0755'
- name: Enable mailman site service
service:
name: "mailman-{{ mailman_site.name }}"
enabled: yes
- name: Create mailman site lists
include_role:
name: mailman-list
vars:
mm_site_name: "{{ mailman_site.name }}"
mm_site_listdomain: "{{ mailman_site.listdomain }}"
mm_list_name: "{{ site_list.name }}"
mm_list_description: "{{ site_list.description }}"
mm_list_admin: "{{ site_list.admin }}"
mm_list_password: "{{ site_list.password }}"
loop: "{{ mailman_site.lists }}"
loop_control:
loop_var: site_list