system-config/playbooks/roles/mailman/tasks/main.yaml
Clark Boylan 4c4e27cb3a Ansible mailman configs
This converts our existing puppeted mailman configuration into a set of
ansible roles and a new playbook. We don't try to do anything new and
instead do our best to map from puppet to ansible as closely as
possible. This helps reduce churn and will help us find problems more
quickly if they happen.

Followups will further cleanup the puppetry.

Change-Id: If8cdb1164c9000438d1977d8965a92ca8eebe4df
2021-05-11 08:40:01 -07:00

129 lines
3.0 KiB
YAML

- name: Install apache2
package:
name:
- apache2
- apache2-utils
state: present
- name: Apache modules
apache2_module:
state: present
name: "{{ a2_mod }}"
loop:
- rewrite
- cgid
- ssl
loop_control:
loop_var: a2_mod
notify: mailman restart apache2
- name: Install mailman
package:
name:
- mailman
state: present
# Install index.html, robots.txt
- name: Install mailman index.html
copy:
src: index.html
dest: /var/www/index.html
owner: root
group: root
mode: '0444'
- name: Install mailman robots.txt
copy:
src: robots.txt
dest: /var/www/robots.txt
owner: root
group: root
mode: '0444'
- name: multihost mailman configs
block:
- name: Create multihost dir
file:
path: /srv/mailman
state: directory
owner: root
group: root
mode: '0755'
- name: Install multihost mailman config
copy:
src: mm_cfg_multihost.py
dest: /etc/mailman/mm_cfg.py
owner: root
group: root
mode: '0444'
- name: Install mailman mk-archives-index
copy:
src: mk-archives-index
dest: /usr/local/sbin/mk-archives-index
owner: root
group: root
mode: '0744'
- name: Set cron PATH for mk-archives-index
cron:
name: PATH
env: yes
job: /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
- name: Enable mk-archives-index cron
cron:
name: "mk-archives-index cron"
state: present
job: mk-archives-index > /var/www/archives.yaml
minute: "0"
hour: "0"
- name: Create mm sites file
template:
src: sites.j2
dest: /etc/mailman/sites
owner: root
group: root
mode: '0444'
- name: Create mailman sites and lists
include_role:
name: mailman-site
vars:
mailman_site: "{{ site }}"
loop: "{{ mailman_sites }}"
loop_control:
loop_var: site
when: mailman_multihost
- name: normal mailman configs
block:
- name: Install normal mailman config
template:
src: mm_cfg.py.j2
dest: /etc/mailman/mm_cfg.py
owner: root
group: root
mode: '0444'
- name: Create normal mailman vhost config
template:
src: mailman.vhost.j2
dest: "/etc/apache2/sites-enabled/50-{{ mailman_listdomain }}.conf"
owner: root
group: root
mode: '0644'
notify: mailman reload apache2
- name: Enable mailman site service
service:
name: "mailman"
enabled: yes
- name: Create mailman site lists
include_role:
name: mailman-list
vars:
mm_site_name: "_default"
mm_list_name: "{{ list.name }}"
mm_list_description: "{{ list.description }}"
mm_list_admin: "{{ list.admin }}"
mm_list_password: "{{ list.password }}"
loop: "{{ mailman_lists }}"
loop_control:
loop_var: list
when: not mailman_multihost