diff --git a/defaults/main.yml b/defaults/main.yml index d46944b..fa1e688 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -82,6 +82,7 @@ mailman_smtp_pwd: '' mailman_smtp_secure_mode: starttls mailman_smtp_conf: '{{ mailman_conf_dir }}/postfix-mailman.cfg' mailman_transport_file_type: regex +mailman_install_maintenance_cronjobs: True mailman_password_length: 12 mailman_webservice_hostname: 'localhost' diff --git a/tasks/main.yml b/tasks/main.yml index 8bb9e5a..bf92ec0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -175,3 +175,26 @@ tags: [ 'mailman', 'postorious', 'hyperkitty', 'mailman_conf' ] + +- name: Add the maintenance cron jobs + block: + - name: Add a daily cron job that sends digests + cron: + job: "{{ mailman_bindir }}/mailman digests --periodic > {{ mailman_log_dir }}/mailman_cron_digest.log 2>&1" + special_time: daily + user: '{{ mailman_user }}' + name: "Mailman digests" + cron_file: 'mailman-digests' + state: present + + - name: Add a daily cron job that sends notifications to the list administrators and list owners + cron: + job: "{{ mailman_bindir }}/mailman notify > {{ mailman_log_dir }}/mailman_cron_notifications.log 2>&1" + minute: '0' + hour: '7' + user: '{{ mailman_user }}' + name: "Mailman notifications" + cron_file: 'mailman-notifications' + state: present + + tags: [ 'mailman', 'postorious', 'hyperkitty', 'mailman_conf', 'mailman_cron' ]