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