diff --git a/defaults/main.yml b/defaults/main.yml index 5381062..1e6b413 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -34,7 +34,8 @@ mailman_custom_templates: - 'it/list:user:notice:probe.txt' - 'it/list:user:notice:welcome.txt' -# Documentation that must be followed to configure the social auth providers +mailman_enable_daily_notifications: true + # Documentation that must be followed to configure the social auth providers # https://django-allauth.readthedocs.io/en/latest/installation.html mailman_use_social_account_providers: False mailman_postorius_social_auth_providers: diff --git a/tasks/mailman.yml b/tasks/mailman.yml index f92e9d1..5915e25 100644 --- a/tasks/mailman.yml +++ b/tasks/mailman.yml @@ -111,27 +111,26 @@ - name: Add the maintenance cron jobs + tags: ['mailman', 'mailman_conf', 'mailman_cron'] block: - name: Add a daily cron job that sends digests cron: - job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg 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 + job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg 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 -C {{ mailman_conf_dir }}/mailman.cfg 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', 'mailman_conf', 'mailman_cron' ] + job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg 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: "{% if mailman_enable_daily_notifications %}present{% else %}absent{% endif %}" - name: Install some default templates block: