From 93e01f3650fc3be057cab6ef4baa44ae81cb3208 Mon Sep 17 00:00:00 2001 From: Kishi85 Date: Wed, 11 May 2022 15:18:00 +0200 Subject: [PATCH] mail: Add mailman3 hyperkitty archiver config --- roles/mail/tasks/main.yml | 4 ++++ .../mailman/mailman-hyperkitty.cfg.j2 | 21 +++++++++++++++++++ .../mail/templates/mailman/mailman-web.py.j2 | 11 +++++++++- roles/mail/templates/mailman/mailman.cfg.j2 | 5 +++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 roles/mail/templates/mailman/mailman-hyperkitty.cfg.j2 diff --git a/roles/mail/tasks/main.yml b/roles/mail/tasks/main.yml index 4e8e4f3..8a98404 100644 --- a/roles/mail/tasks/main.yml +++ b/roles/mail/tasks/main.yml @@ -143,6 +143,10 @@ template: src=mailman/mailman.cfg.j2 dest=/etc/mailman3/mailman.cfg notify: Restart mailman3 +- name: Configure mailman3 hyperkitty plugin + template: src=mailman/mailman-hyperkitty.cfg.j2 dest=/etc/mailman3/mailman-hyperkitty.cfg + notify: Restart mailman3 + - name: Configure mailman3-web template: src=mailman/mailman-web.py.j2 dest=/etc/mailman3/mailman-web.py notify: Restart mailman3web diff --git a/roles/mail/templates/mailman/mailman-hyperkitty.cfg.j2 b/roles/mail/templates/mailman/mailman-hyperkitty.cfg.j2 new file mode 100644 index 0000000..165e1a3 --- /dev/null +++ b/roles/mail/templates/mailman/mailman-hyperkitty.cfg.j2 @@ -0,0 +1,21 @@ +# This is the mailman extension configuration file to enable HyperKitty as an +# archiver. Remember to add the following lines in the mailman.cfg file: +# +# [archiver.hyperkitty] +# class: mailman_hyperkitty.Archiver +# enable: yes +# configuration: /etc/mailman3/mailman-hyperkitty.cfg +# + +[general] + +# This is your HyperKitty installation, preferably on the localhost. This +# address will be used by Mailman to forward incoming emails to HyperKitty +# for archiving. It does not need to be publicly available, in fact it's +# better if it is not. +#base_url: http://localhost/mailman3/hyperkitty/ +base_url: https://{{ mailman_domain }}/mailman3/hyperkitty/ + +# Shared API key, must be the identical to the value in HyperKitty's +# settings. +api_key: {{ mailman3_archiverkey }} diff --git a/roles/mail/templates/mailman/mailman-web.py.j2 b/roles/mail/templates/mailman/mailman-web.py.j2 index 143cdb2..0f8071e 100644 --- a/roles/mail/templates/mailman/mailman-web.py.j2 +++ b/roles/mail/templates/mailman/mailman-web.py.j2 @@ -25,7 +25,16 @@ MAILMAN_REST_API_URL = 'http://localhost:8001' MAILMAN_REST_API_USER = 'restadmin' MAILMAN_REST_API_PASS = '{{ mailman3_restadminpass }}' MAILMAN_ARCHIVER_KEY = '{{ mailman3_archiverkey }}' -MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1') +MAILMAN_ARCHIVER_FROM = ( + '127.0.0.1', + '::1', +{% if hostvars[inventory_hostname]['ansible_default_ipv4']['address'] is defined %} + '{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address']}}', +{% endif%} +{% if hostvars[inventory_hostname]['ansible_default_ipv6']['address'] is defined %} + '{{ hostvars[inventory_hostname]['ansible_default_ipv6']['address']}}', +{% endif%} +) # Application definition diff --git a/roles/mail/templates/mailman/mailman.cfg.j2 b/roles/mail/templates/mailman/mailman.cfg.j2 index 7e007f1..54bf6ba 100644 --- a/roles/mail/templates/mailman/mailman.cfg.j2 +++ b/roles/mail/templates/mailman/mailman.cfg.j2 @@ -68,3 +68,8 @@ smtp_pass: lmtp_host: 127.0.0.1 lmtp_port: 8024 configuration: python:mailman.config.postfix + +[archiver.hyperkitty] +class: mailman_hyperkitty.Archiver +enable: yes +configuration: /etc/mailman3/mailman-hyperkitty.cfg