forked from ISTI-ansible-roles/ansible-role-mailman
93 lines
3.8 KiB
YAML
93 lines
3.8 KiB
YAML
---
|
|
- name: Create the postorius and hyperkitty environments
|
|
block:
|
|
- name: Set httpd_can_network_connect flag on and keep it persistent across reboots
|
|
seboolean:
|
|
name: httpd_can_network_connect
|
|
state: yes
|
|
persistent: yes
|
|
|
|
- name: Create the postorius log directory
|
|
file: dest={{ item }} state=directory owner={{ mailman_user }} group={{ mailman_user }}
|
|
with_items:
|
|
- '{{ mailman_postorius_log_dir }}'
|
|
|
|
- name: Download the mailmansuite repository
|
|
become: True
|
|
become_user: '{{ mailman_user }}'
|
|
git:
|
|
dest: '{{ mailman_home }}/mailman-suite'
|
|
repo: '{{ mailman_repository }}'
|
|
force: yes
|
|
track_submodules: no
|
|
clone: yes
|
|
update: yes
|
|
recursive: yes
|
|
|
|
- name: Install the postorius setting files
|
|
become: True
|
|
become_user: '{{ mailman_user }}'
|
|
template: src=postorius_{{ item.name }}.j2 dest={{ mailman_postorius_dir }}/{{ item.name }} mode={{ item.perms }}
|
|
with_items: '{{ mailman_postorius_settings_files }}'
|
|
register: postorius_conf
|
|
|
|
- name: Install the UWSGI configuration
|
|
template: src=postorius_{{ item }}.j2 dest=/etc/{{ item }} mode=0640
|
|
with_items:
|
|
- 'uwsgi.ini'
|
|
|
|
- name: Setup postorius and hyperkitty
|
|
become_user: '{{ mailman_user }}'
|
|
shell: cd '{{ mailman_postorius_dir }}' && mkdir -p locale && {{ mailman_home }}/{{ mailman_virtualenv_name }}/bin/python3 manage.py migrate && {{ mailman_home }}/{{ mailman_virtualenv_name }}/bin/python3 manage.py compilemessages && {{ mailman_home }}/{{ mailman_virtualenv_name }}/bin/python3 manage.py collectstatic
|
|
args:
|
|
creates: '{{ mailman_postorius_dir }}/static/admin/js/actions.js'
|
|
|
|
- name: Ensure that the UWSGI postorius service is started and enabled
|
|
service: name=uwsgi state=started enabled=yes
|
|
|
|
- name: Restart the UWSGI service if needed
|
|
service: name=uwsgi state=restarted
|
|
when: postorius_conf is changed
|
|
|
|
- name: Install the hyperkitty configuration file
|
|
template: src=mailman-hyperkitty.cfg.j2 dest={{ mailman_conf_dir }}/mailman-hyperkitty.cfg owner=root group={{ mailman_user }} mode=0440
|
|
when: mailman_use_hyperkitty_archiver | bool
|
|
register: mailman_hyperkitty_install
|
|
|
|
tags: [ 'mailman', 'postorius', 'hyperkitty', 'mailman_conf' ]
|
|
|
|
- name: Setup the postorius cron jobs
|
|
block:
|
|
- name: add a cron job that syncs the mailman core and postorius settings
|
|
cron:
|
|
job: "{{ mailman_postorius_dir }}/manage.py runjobs {{ item }} > {{ mailman_postorius_log_dir }}/runjobs-{{ item }}.log 2>&1"
|
|
special_time: '{{ item }}'
|
|
user: '{{ mailman_user }}'
|
|
name: "postorius / hyperkitty runjobs {{ item }}"
|
|
cron_file: 'postorius-runjobs-{{ item }}'
|
|
state: present
|
|
disabled: no
|
|
with_items: '{{ mailman_postorius_cronjob_frequency }}'
|
|
|
|
- name: postorius cron job that runs every 15 minutes
|
|
cron:
|
|
job: "{{ mailman_postorius_dir }}/manage.py runjobs quarter_hourly > {{ mailman_postorius_log_dir }}/runjobs-quarter_hourly.log 2>&1"
|
|
minute: "3,18,33,48"
|
|
user: '{{ mailman_user }}'
|
|
name: "postorius / hyperkitty runjobs quarter_hourly"
|
|
cron_file: 'postorius-runjobs-quarter_hourly'
|
|
disabled: no
|
|
state: present
|
|
|
|
- name: postorius cron job that runs every minute
|
|
cron:
|
|
job: "{{ mailman_postorius_dir }}/manage.py runjobs minutely > {{ mailman_postorius_log_dir }}/runjobs-minutely.log 2>&1"
|
|
minute: "*"
|
|
user: '{{ mailman_user }}'
|
|
name: "postorius / hyperkitty runjobs minutely"
|
|
cron_file: 'postorius-runjobs-minutely'
|
|
state: present
|
|
disabled: no
|
|
|
|
tags: [ 'mailman', 'postorius', 'hyperkitty', 'mailman_conf', 'postorius_cron' ]
|