From cf67c8a82d05b453abb347d90861ad02607743cf Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 15 Sep 2026 18:00:06 +0200 Subject: [PATCH] Add a tag to the tasks that install the generic templates. --- defaults/main.yml | 7 ++++ tasks/mailman.yml | 58 ++++++++++++++++++++++++++-------- tasks/postorius-hyperkitty.yml | 6 ++-- 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8d31966..f2dae05 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -34,6 +34,13 @@ mailman_custom_templates: - 'it/list:user:notice:probe.txt' - 'it/list:user:notice:welcome.txt' +# Subset of the custom templates required by the archive-aware footer feature. +# Keeping it separate allows the feature to be deployed without reinstalling +# every site-level Mailman template. +mailman_archive_footer_templates: + - 'en/list:member:generic:footer.txt' + - 'it/list:member:generic:footer.txt' + mailman_enable_daily_notifications: true # Periodically perform a verified stop/start cycle. The timer is disabled by diff --git a/tasks/mailman.yml b/tasks/mailman.yml index 3aba406..f24ee03 100644 --- a/tasks/mailman.yml +++ b/tasks/mailman.yml @@ -53,17 +53,21 @@ with_items: '{{ mailman_pip_packages }}' - name: Install the legacy HyperKitty compatibility patcher - template: + ansible.builtin.template: src: mailman-legacy-hyperkitty-compatibility.py.j2 dest: '{{ mailman_legacy_hyperkitty_patch_script }}' owner: root group: root mode: '0750' when: mailman_enable_legacy_hyperkitty_compatibility_patches | bool - tags: [ 'mailman', 'mailman_conf', 'mailman_hyperkitty_compatibility' ] + tags: + - mailman + - mailman_conf + - mailman_hyperkitty_compatibility + - mailman_archive_footer - name: Apply the legacy HyperKitty compatibility patches - command: + ansible.builtin.command: argv: - '{{ mailman_bindir }}/python' - '{{ mailman_legacy_hyperkitty_patch_script }}' @@ -76,7 +80,11 @@ - Restart hyperkitty qcluster - Restart mailmansuite - Restart mailman - tags: [ 'mailman', 'mailman_conf', 'mailman_hyperkitty_compatibility' ] + tags: + - mailman + - mailman_conf + - mailman_hyperkitty_compatibility + - mailman_archive_footer - name: Install the mailman and postfix configuration files template: src={{ item }}.j2 dest={{ mailman_conf_dir }}/{{ item }} owner=root group={{ mailman_user }} mode=0440 @@ -254,16 +262,38 @@ cron_file: 'mailman-notifications' state: "{% if mailman_enable_daily_notifications %}present{% else %}absent{% endif %}" -- name: Install some default templates +- name: Install default Mailman templates + tags: [mailman, mailman_templates] block: - - name: Create the 'site' directory and the language subdirs - file: dest={{ mailman_var_dir }}/templates/site/{{ item }} state=directory owner={{ mailman_user }} group={{ mailman_user}} - with_items: - - it - - en + - name: Create the site-level Mailman template directories + ansible.builtin.file: + path: '{{ mailman_var_dir }}/templates/site/{{ item }}' + state: directory + owner: '{{ mailman_user }}' + group: '{{ mailman_user }}' + mode: '0755' + loop: + - it + - en + tags: [mailman_archive_footer] - - name: Install the custom templates - template: src=site/{{ item }}.j2 dest={{ mailman_var_dir }}/templates/site/{{ item }} owner={{ mailman_user }} group={{ mailman_user}} - with_items: '{{ mailman_custom_templates }}' + - name: Install custom Mailman templates other than the archive footer + ansible.builtin.template: + src: 'site/{{ item }}.j2' + dest: '{{ mailman_var_dir }}/templates/site/{{ item }}' + owner: '{{ mailman_user }}' + group: '{{ mailman_user }}' + mode: '0644' + loop: '{{ mailman_custom_templates }}' + when: item not in mailman_archive_footer_templates - tags: [ 'mailman', 'mailman_templates' ] + - name: Install archive-aware Mailman footer templates + ansible.builtin.template: + src: 'site/{{ item }}.j2' + dest: '{{ mailman_var_dir }}/templates/site/{{ item }}' + owner: '{{ mailman_user }}' + group: '{{ mailman_user }}' + mode: '0644' + loop: '{{ mailman_archive_footer_templates }}' + when: item in mailman_custom_templates + tags: [mailman_archive_footer] diff --git a/tasks/postorius-hyperkitty.yml b/tasks/postorius-hyperkitty.yml index 2ed8677..50db3e6 100644 --- a/tasks/postorius-hyperkitty.yml +++ b/tasks/postorius-hyperkitty.yml @@ -47,7 +47,7 @@ mode: '0750' register: mailman_postorius_site_config_helper_install when: mailman_manage_postorius_site | bool - tags: [mailman_postorius_site] + tags: [mailman_postorius_site, mailman_archive_footer] - name: Configure the canonical Django Site used by archive links become: true @@ -66,7 +66,7 @@ - >- not ansible_check_mode or mailman_postorius_site_config_helper_install is not changed - tags: [mailman_postorius_site] + tags: [mailman_postorius_site, mailman_archive_footer] - name: Install the hyperkitty configuration file ansible.builtin.template: @@ -78,7 +78,7 @@ when: mailman_use_hyperkitty_archiver | bool register: mailman_hyperkitty_install notify: Restart mailman - tags: [mailman_postorius_site] + tags: [mailman_postorius_site, mailman_archive_footer] tags: [mailman, postorius, hyperkitty, mailman_conf]