Changed some configuration

This commit is contained in:
Franca Debole 2020-01-15 17:53:18 +01:00
parent ccaf0bfff6
commit be9feb1253
20 changed files with 356 additions and 356 deletions

View File

@ -2,79 +2,79 @@
# TODO: make sure you point out to set django secret_key, django admins, django archive key? # TODO: make sure you point out to set django secret_key, django admins, django archive key?
mailman3_install_method: pip mailman_install_method: pip
mailman3_language: en mailman_language: en
mailman3_language_code: en-us mailman_language_code: en-us
mailman3_install_system_dependencies: "{{ __mailman3_debian or __mailman3_redhat }}" mailman_install_system_dependencies: "{{ __mailman_debian or __mailman_redhat }}"
mailman3_python_uwsgi_package: pyuwsgi mailman_python_uwsgi_package: pyuwsgi
mailman3_backup_configs: false mailman_backup_configs: false
# list of dicts with keys `name`, `email`, `pass` # list of dicts with keys `name`, `email`, `pass`
mailman3_django_superusers: [] mailman_django_superusers: []
# list of hosted domains # list of hosted domains
#mailman3_domains: [] #mailman_domains: []
# If mailman3_domains is set, mailman3_config.default_from_email is ignored since it's assumed you want per-domain # If mailman_domains is set, mailman_config.default_from_email is ignored since it's assumed you want per-domain
# addresses. In this case, set the username portion of the email (the domain will be added automatically) # addresses. In this case, set the username portion of the email (the domain will be added automatically)
mailman3_default_from_user: postorius mailman_default_from_user: postorius
# Distribute Postfix maps to MXs for use with relay_recipient_maps, so that MXs can reject mail to nonexistent # Distribute Postfix maps to MXs for use with relay_recipient_maps, so that MXs can reject mail to nonexistent
# addresses. Installs Ansible and a playbook in a virtualenv. User/auth setup is up to you. # addresses. Installs Ansible and a playbook in a virtualenv. User/auth setup is up to you.
# #
# list of dicts, required keys: # list of dicts, required keys:
# host: inventory_hostname of mx (or "all") for vars to apply to all hosts # host: inventory_hostname of mx (or "all") for vars to apply to all hosts
# mailman3_distribute_maps_dir: remote directory on mx to distribute maps to # mailman_distribute_maps_dir: remote directory on mx to distribute maps to
# all keys other than "host" are set as either host vars or in [all:vars] if host = "all" # all keys other than "host" are set as either host vars or in [all:vars] if host = "all"
#mailman3_distribute_maps: [] #mailman_distribute_maps: []
mailman3_distribute_maps_dir: "{{ mailman3_var_dir }}/distribute_maps" mailman_distribute_maps_dir: "{{ mailman_var_dir }}/distribute_maps"
# For pip installs, the role creates a venv at this path # For pip installs, the role creates a venv at this path
mailman3_install_dir: /opt/mailman3 mailman_install_dir: /opt/mailman
# uWSGI/proxy communication socket (value only used for pip installs, Debian uses a hardcoded default) # uWSGI/proxy communication socket (value only used for pip installs, Debian uses a hardcoded default)
mailman3_uwsgi_socket: "{{ mailman3_django_var_dir }}/run/uwsgi.sock" mailman_uwsgi_socket: "{{ mailman_django_var_dir }}/run/uwsgi.sock"
# Optionally serve directly with uWSGI # Optionally serve directly with uWSGI
#mailman3_http_socket: #mailman_http_socket:
mailman3_uwsgi_static: no mailman_uwsgi_static: no
# You should rarely need to set these # You should rarely need to set these
#mailman3_virtualenv_python: python3 #mailman_virtualenv_python: python3
#mailman3_virtualenv_command: python3 -m venv # https://github.com/ansible/ansible/issues/52275 #mailman_virtualenv_command: python3 -m venv # https://github.com/ansible/ansible/issues/52275
mailman3_virtualenv_command: pyvenv mailman_virtualenv_command: pyvenv
__mailman3_debian: "{{ ansible_os_family == 'Debian' }}" __mailman_debian: "{{ ansible_os_family == 'Debian' }}"
__mailman3_redhat: "{{ ansible_os_family == 'RedHat' }}" __mailman_redhat: "{{ ansible_os_family == 'RedHat' }}"
__mailman3_pip: "{{ mailman3_install_method == 'pip' }}" __mailman_pip: "{{ mailman_install_method == 'pip' }}"
# pip needed packages if using the pip install method, system packages if using the package method # pip needed packages if using the pip install method, system packages if using the package method
__mailman3_pip_packages: __mailman_pip_packages:
- whoosh - whoosh
- django>=1.11 - django>=1.11
- mailman - mailman
- postorius - postorius
- hyperkitty - hyperkitty
- mailman-hyperkitty - mailman-hyperkitty
- "{{ mailman3_python_uwsgi_package }}" - "{{ mailman_python_uwsgi_package }}"
__mailman3_debian_packages: __mailman_debian_packages:
- mailman3-full - mailman-full
__mailman3_redhat_packages: null # currently nonexistent __mailman_redhat_packages: null # currently nonexistent
mailman3_packages: >- mailman_packages: >-
{{ {{
__mailman3_pip_packages if __mailman3_pip else ( __mailman_pip_packages if __mailman_pip else (
__mailman3_debian_packages if __mailman3_debian else __mailman_debian_packages if __mailman_debian else
__mailman3_redhat_packages) __mailman_redhat_packages)
}} }}
# for e.g. psycopg2 # for e.g. psycopg2
mailman3_extra_packages: [] mailman_extra_packages: []
# Dependant system packages needed if using the pip install method # Dependant system packages needed if using the pip install method
__mailman3_debian_system_dependency_packages: __mailman_debian_system_dependency_packages:
- python3 # requires Ubuntu >= 16.04, Debian >= stretch (for 3.5) - python3 # requires Ubuntu >= 16.04, Debian >= stretch (for 3.5)
- python3-setuptools # Ansible pip module needs this despite having venv; UPDATE: no it doesn't if it can find python3; UPDATE2: well now it does again, wtf - python3-setuptools # Ansible pip module needs this despite having venv; UPDATE: no it doesn't if it can find python3; UPDATE2: well now it does again, wtf
- python3-venv - python3-venv
- sassc - sassc
- uwsgi - uwsgi
- uwsgi-plugin-python3 - uwsgi-plugin-python3
__mailman3_redhat_system_dependency_packages: __mailman_redhat_system_dependency_packages:
# all require EPEL # all require EPEL
- python36 # requires EL7+ - python36 # requires EL7+
- sassc - sassc
@ -84,149 +84,149 @@ __mailman3_redhat_system_dependency_packages:
# - rcssmin # - rcssmin
# - rjsmin # - rjsmin
# But this role will not install compilers in case wheels become available at a later date # But this role will not install compilers in case wheels become available at a later date
mailman3_system_dependency_packages: >- mailman_system_dependency_packages: >-
{{ {{
__mailman3_debian_system_dependency_packages if __mailman3_debian else __mailman_debian_system_dependency_packages if __mailman_debian else
__mailman3_redhat_system_dependency_packages __mailman_redhat_system_dependency_packages
}} }}
# TODO: supervisor # TODO: supervisor
mailman3_process_manager: >- mailman_process_manager: >-
{{ {{
'systemd' if ansible_virtualization_type != 'docker' else None 'systemd' if ansible_virtualization_type != 'docker' else None
}} }}
mailman3_core_service_name: >- mailman_core_service_name: >-
{{ {{
'mailman3-core' if __mailman3_pip else ( 'mailman-core' if __mailman_pip else (
'mailman3' if __mailman3_debian else 'mailman' if __mailman_debian else
None) None)
}} }}
mailman3_web_service_name: >- mailman_web_service_name: >-
{{ {{
'mailman3-web' if __mailman3_pip else ( 'mailman-web' if __mailman_pip else (
'mailman3-web' if __mailman3_debian else 'mailman-web' if __mailman_debian else
None) None)
}} }}
mailman3_etc_dir: >- mailman_etc_dir: >-
{{ {{
'/etc/opt/mailman3' if __mailman3_pip else ( '/opt/mailman/var/etc' if __mailman_pip else (
'/etc/mailman3' if __mailman3_debian else '/etc/mailman' if __mailman_debian else
None) None)
}} }}
mailman3_var_dir: >- mailman_var_dir: >-
{{ {{
'/var/opt/mailman3/core' if __mailman3_pip else ( '/opt/mailman/var' if __mailman_pip else (
'/var/lib/mailman3' if __mailman3_debian else '/var/lib/mailman' if __mailman_debian else
None) None)
}} }}
mailman3_log_dir: >- mailman_log_dir: >-
{{ {{
'/var/opt/mailman3/core/log' if __mailman3_pip else ( '/opt/mailman/var/log' if __mailman_pip else (
'/var/log/mailman3' if __mailman3_debian else '/var/log/mailman' if __mailman_debian else
None) None)
}} }}
mailman3_django_var_dir: >- mailman_django_var_dir: >-
{{ {{
'/var/opt/mailman3/web' if __mailman3_pip else ( '/var/opt/mailman/web' if __mailman_pip else (
'/var/lib/mailman3' if __mailman3_debian else '/var/lib/mailman' if __mailman_debian else
None) None)
}} }}
mailman3_django_project_dir: >- mailman_django_project_dir: >-
{{ {{
'/var/opt/mailman3/web/project' if __mailman3_pip else ( '/var/opt/mailman/web/project' if __mailman_pip else (
'/usr/share/mailman3-web' if __mailman3_debian else '/usr/share/mailman-web' if __mailman_debian else
None) None)
}} }}
mailman3_django_static_dir: >- mailman_django_static_dir: >-
{{ {{
'/var/opt/mailman3/web/static' if __mailman3_pip else ( '/var/opt/mailman/web/static' if __mailman_pip else (
'/var/lib/mailman3/web/static' if __mailman3_debian else '/var/lib/mailman/web/static' if __mailman_debian else
None) None)
}} }}
mailman3_django_log_dir: >- mailman_django_log_dir: >-
{{ {{
'/var/opt/mailman3/web/log' if __mailman3_pip else ( '/var/opt/mailman/web/log' if __mailman_pip else (
'/var/log/mailman3/web' if __mailman3_debian else '/var/log/mailman/web' if __mailman_debian else
None) None)
}} }}
mailman3_django_settings_file: >- mailman_django_settings_file: >-
{{ {{
'/etc/opt/mailman3/django-settings.py' if __mailman3_pip else ( '/opt/mailman/django-settings.py' if __mailman_pip else (
'/etc/mailman3/mailman-web.py' if __mailman3_debian else '/etc/mailman/mailman-web.py' if __mailman_debian else
None) None)
}} }}
mailman3_web_user: >- mailman_web_user: >-
{{ {{
'www-data' if __mailman3_debian else ( 'www-data' if __mailman_debian else (
None) None)
}} }}
# TODO: # TODO:
#'httpd' if __mailman3_redhat and apache #'httpd' if __mailman_redhat and apache
#'nginx' if __mailman3_redhat and nginx #'nginx' if __mailman_redhat and nginx
mailman3_web_group: >- mailman_web_group: >-
{{ {{
'www-data' if __mailman3_debian else ( 'www-data' if __mailman_debian else (
None) None)
}} }}
mailman3_core_api_hostname: localhost mailman_core_api_hostname: localhost
mailman3_core_api_port: 8001 mailman_core_api_port: 8001
mailman3_core_api_admin_user: restadmin mailman_core_api_admin_user: restadmin
mailman3_core_api_admin_pass: restpass mailman_core_api_admin_pass: restpass
mailman3_archiver_key: SecretArchiverAPIKey mailman_archiver_key: SecretArchiverAPIKey
__mailman3_config_default: __mailman_config_default:
mailman: mailman:
layout: custom layout: custom
paths.custom: paths.custom:
var_dir: "{{ mailman3_var_dir }}" var_dir: "{{ mailman_var_dir }}"
bin_dir: "$argv" bin_dir: "$argv"
log_dir: "{{ mailman3_log_dir }}" log_dir: "{{ mailman_log_dir }}"
lock_dir: "{{ mailman3_var_dir }}/locks" lock_dir: "{{ mailman_var_dir }}/locks"
data_dir: "{{ mailman3_var_dir }}/data" data_dir: "{{ mailman_var_dir }}/data"
cache_dir: "{{ mailman3_var_dir }}/cache" cache_dir: "{{ mailman_var_dir }}/cache"
etc_dir: "{{ mailman3_etc_dir }}" etc_dir: "{{ mailman_etc_dir }}"
messages_dir: "{{ mailman3_var_dir }}/messages" messages_dir: "{{ mailman_var_dir }}/messages"
archives_dir: "{{ mailman3_var_dir }}/archives" archives_dir: "{{ mailman_var_dir }}/archives"
template_dir: "{{ mailman3_var_dir }}/templates" template_dir: "{{ mailman_var_dir }}/templates"
pid_file: "{{ mailman3_var_dir }}/master.pid" pid_file: "{{ mailman_var_dir }}/master.pid"
lock_file: "{{ mailman3_var_dir }}/master.lck" lock_file: "{{ mailman_var_dir }}/master.lck"
webservice: webservice:
hostname: "{{ mailman3_core_api_hostname }}" hostname: "{{ mailman_core_api_hostname }}"
port: "{{ mailman3_core_api_port }}" port: "{{ mailman_core_api_port }}"
use_https: "no" use_https: "no"
admin_user: "{{ mailman3_core_api_admin_user }}" admin_user: "{{ mailman_core_api_admin_user }}"
admin_pass: "{{ mailman3_core_api_admin_pass }}" admin_pass: "{{ mailman_core_api_admin_pass }}"
api_version: "3.1" api_version: "3.1"
archiver.hyperkitty: archiver.hyperkitty:
class: mailman_hyperkitty.Archiver class: mailman_hyperkitty.Archiver
enable: "yes" enable: "yes"
configuration: "{{ mailman3_etc_dir }}/hyperkitty.cfg" configuration: "{{ mailman_etc_dir }}/hyperkitty.cfg"
__mailman3_config_merged: "{{ __mailman3_config_default | combine(mailman3_config | default({}), recursive=True) }}" __mailman_config_merged: "{{ __mailman_config_default | combine(mailman_config | default({}), recursive=True) }}"
__mailman3_django_config_default: __mailman_django_config_default:
admins: "{{ mailman3_django_superusers }}" admins: "{{ mailman_django_superusers }}"
allowed_hosts: "{{ mailman3_domains | default([inventory_hostname]) }}" allowed_hosts: "{{ mailman_domains | default([inventory_hostname]) }}"
rest_api_url: "http://{{ mailman3_core_api_hostname }}:{{ mailman3_core_api_port }}" rest_api_url: "http://{{ mailman_core_api_hostname }}:{{ mailman_core_api_port }}"
rest_api_user: "{{ mailman3_core_api_admin_user }}" rest_api_user: "{{ mailman_core_api_admin_user }}"
rest_api_pass: "{{ mailman3_core_api_admin_pass }}" rest_api_pass: "{{ mailman_core_api_admin_pass }}"
archiver_key: "{{ mailman3_archiver_key }}" archiver_key: "{{ mailman_archiver_key }}"
databases: databases:
default: default:
ENGINE: django.db.backends.sqlite3 ENGINE: django.db.backends.sqlite3
NAME: "{{ mailman3_django_var_dir }}/db/mailmansuite.db" NAME: "{{ mailman_django_var_dir }}/db/mailmansuite.db"
USER: '' USER: ''
PASSWORD: '' PASSWORD: ''
HOST: '' HOST: ''
@ -239,18 +239,18 @@ __mailman3_django_config_default:
server_email: root@{{ inventory_hostname }} server_email: root@{{ inventory_hostname }}
compress_offline: true compress_offline: true
socialaccount_providers: {} socialaccount_providers: {}
__mailman3_django_config_merged: "{{ __mailman3_django_config_default | combine(mailman3_django_config | default({}), recursive=True) }}" __mailman_django_config_merged: "{{ __mailman_django_config_default | combine(mailman_django_config | default({}), recursive=True) }}"
mailman3_postorius_root: 'postorius/' mailman_postorius_root: 'postorius/'
mailman3_hyperkitty_root: 'hyperkitty/' mailman_hyperkitty_root: 'hyperkitty/'
#mailman3_user: mailman #mailman_user: mailman
mailman3_create_user: "{{ __mailman3_pip and not __mailman3_debian }}" mailman_create_user: "{{ __mailman_pip and not __mailman_debian }}"
__mailman3_debian_user_name: list __mailman_debian_user_name: list
__mailman3_user_name: >- __mailman_user_name: >-
{{ {{
(mailman3_user | default({})).name | default( (mailman_user | default({})).name | default(
__mailman3_debian_user_name if __mailman3_debian else __mailman_debian_user_name if __mailman_debian else
'mailman') 'mailman')
}} }}

View File

@ -5,17 +5,17 @@
tasks: tasks:
- name: Check postfix_lmtp - name: Check postfix_lmtp
stat: stat:
path: "{{ mailman3_var_dir }}/data/postfix_lmtp" path: "{{ mailman_var_dir }}/data/postfix_lmtp"
register: result register: result
delegate_to: localhost delegate_to: localhost
run_once: true run_once: true
- name: Copy postfix_lmtp - name: Copy postfix_lmtp
copy: copy:
src: "{{ mailman3_var_dir }}/data/postfix_lmtp" src: "{{ mailman_var_dir }}/data/postfix_lmtp"
dest: "{{ mailman3_distribute_maps_dir }}/postfix_lmtp" dest: "{{ mailman_distribute_maps_dir }}/postfix_lmtp"
when: result.stat.exists when: result.stat.exists
notify: notify:
- postmap - postmap
handlers: handlers:
- name: postmap - name: postmap
command: "{{ mailman3_postmap_command | default('postmap') }} {{ mailman3_distribute_maps_dir | quote }}/postfix_lmtp" command: "{{ mailman_postmap_command | default('postmap') }} {{ mailman_distribute_maps_dir | quote }}/postfix_lmtp"

View File

@ -4,15 +4,15 @@
systemd: systemd:
daemon_reload: yes daemon_reload: yes
- name: restart mailman3-core service - name: restart mailman-core service
service: service:
name: "{{ mailman3_core_service_name }}" name: "{{ mailman_core_service_name }}"
state: restarted state: restarted
when: ansible_virtualization_type != "docker" when: ansible_virtualization_type != "docker"
- name: restart mailman3-web service - name: restart mailman-web service
service: service:
name: "{{ mailman3_web_service_name }}{{ '@' if mailman3_domains is defined else '' }}{{ item }}" name: "{{ mailman_web_service_name }}{{ '@' if mailman_domains is defined else '' }}{{ item }}"
state: restarted state: restarted
loop: "{{ mailman3_domains | default(['']) }}" loop: "{{ mailman_domains | default(['']) }}"
when: ansible_virtualization_type != "docker" when: ansible_virtualization_type != "docker"

View File

@ -23,6 +23,6 @@ galaxy_info:
- list - list
- lists - lists
- mailman - mailman
- mailman3 - mailman
dependencies: [] dependencies: []

View File

@ -3,30 +3,30 @@
- name: Create/update Mailman Core configuration - name: Create/update Mailman Core configuration
template: template:
src: mailman.cfg.j2 src: mailman.cfg.j2
dest: "{{ mailman3_etc_dir }}/mailman.cfg" dest: "{{ mailman_etc_dir }}/mailman.cfg"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0640" mode: "0640"
backup: "{{ mailman3_backup_configs }}" backup: "{{ mailman_backup_configs }}"
notify: notify:
- restart mailman3-core service - restart mailman-core service
- name: Create HyperKitty configuration file - name: Create HyperKitty configuration file
copy: copy:
content: | content: |
[general] [general]
base_url: http://localhost/{{ mailman3_hyperkitty_root }} base_url: http://localhost/{{ mailman_hyperkitty_root }}
api_key: {{ mailman3_archiver_key }} api_key: {{ mailman_archiver_key }}
dest: "{{ mailman3_etc_dir }}/hyperkitty.cfg" dest: "{{ mailman_etc_dir }}/hyperkitty.cfg"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
notify: notify:
- restart mailman3-core service - restart mailman-core service
- name: Create/update Django project - name: Create/update Django project
template: template:
src: "{{ item.name }}.j2" src: "{{ item.name }}.j2"
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
dest: "{{ mailman3_django_project_dir }}/{{ item.name }}" dest: "{{ mailman_django_project_dir }}/{{ item.name }}"
backup: "{{ mailman3_backup_configs }}" backup: "{{ mailman_backup_configs }}"
with_items: with_items:
- name: manage.py - name: manage.py
mode: "0755" mode: "0755"
@ -36,28 +36,28 @@
mode: "0644" mode: "0644"
- name: wsgi.py - name: wsgi.py
mode: "0644" mode: "0644"
when: __mailman3_pip when: __mailman_pip
notify: notify:
- restart mailman3-web service - restart mailman-web service
- name: Create/update Django local settings - name: Create/update Django local settings
template: template:
src: "settings_local.py.j2" src: "settings_local.py.j2"
dest: "{{ mailman3_django_settings_file }}" dest: "{{ mailman_django_settings_file }}"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0640" mode: "0640"
backup: "{{ mailman3_backup_configs }}" backup: "{{ mailman_backup_configs }}"
notify: notify:
- restart mailman3-web service - restart mailman-web service
- name: Create Django local settings symlink - name: Create Django local settings symlink
file: file:
src: "{{ mailman3_django_settings_file }}" src: "{{ mailman_django_settings_file }}"
dest: "{{ mailman3_django_project_dir }}/settings_local.py" dest: "{{ mailman_django_project_dir }}/settings_local.py"
state: link state: link
when: __mailman3_pip when: __mailman_pip
notify: notify:
- restart mailman3-web service - restart mailman-web service
- name: Create Django site configs - name: Create Django site configs
copy: copy:
@ -67,36 +67,36 @@
# override any configured SITE_ID # override any configured SITE_ID
SITE_ID = {{ site_id + 1 }} SITE_ID = {{ site_id + 1 }}
FILTER_VHOST = True FILTER_VHOST = True
DEFAULT_FROM_EMAIL = '{{ mailman3_default_from_user }}@{{ domain }}' DEFAULT_FROM_EMAIL = '{{ mailman_default_from_user }}@{{ domain }}'
dest: "{{ mailman3_django_project_dir }}/settings_{{ domain | replace('.', '_') | replace('-', '_') }}.py" dest: "{{ mailman_django_project_dir }}/settings_{{ domain | replace('.', '_') | replace('-', '_') }}.py"
loop: "{{ mailman3_domains | default([]) }}" loop: "{{ mailman_domains | default([]) }}"
loop_control: loop_control:
index_var: site_id index_var: site_id
loop_var: domain loop_var: domain
when: mailman3_domains is defined when: mailman_domains is defined
notify: notify:
- restart mailman3-web service - restart mailman-web service
# This runs before collectstatic because it creates the log file, which must be created as the web user # This runs before collectstatic because it creates the log file, which must be created as the web user
- name: Create/update Django DB schema - name: Create/update Django DB schema
django_manage: django_manage:
command: migrate command: migrate
app_path: "{{ mailman3_django_project_dir }}" app_path: "{{ mailman_django_project_dir }}"
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
# FIXME: # FIXME:
become: yes become: yes
become_user: "{{ mailman3_web_user }}" become_user: "{{ mailman_web_user }}"
#become_method: su #become_method: su
#become_flags: '-s /bin/sh' #become_flags: '-s /bin/sh'
notify: notify:
- restart mailman3-web service - restart mailman-web service
- name: Collect Django static files - name: Collect Django static files
django_manage: django_manage:
command: collectstatic command: collectstatic
app_path: "{{ mailman3_django_project_dir }}" app_path: "{{ mailman_django_project_dir }}"
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
when: __mailman3_pip when: __mailman_pip
- name: Check Django superusers - name: Check Django superusers
django_manage: django_manage:
@ -104,16 +104,16 @@
shell -c 'import sys; shell -c 'import sys;
from django.contrib.auth.models import User; from django.contrib.auth.models import User;
sys.stdout.write("exists") if User.objects.filter(username="{{ item.name }}").count() > 0 else sys.stdout.write("missing")' sys.stdout.write("exists") if User.objects.filter(username="{{ item.name }}").count() > 0 else sys.stdout.write("missing")'
app_path: "{{ mailman3_django_project_dir }}" app_path: "{{ mailman_django_project_dir }}"
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
with_items: "{{ mailman3_django_superusers }}" with_items: "{{ mailman_django_superusers }}"
register: __mailman3_checksuperuser_result register: __mailman_checksuperuser_result
changed_when: __mailman3_checksuperuser_result.out == "missing" changed_when: __mailman_checksuperuser_result.out == "missing"
loop_control: loop_control:
label: "{{ item.name }}" label: "{{ item.name }}"
# FIXME: # FIXME:
become: yes become: yes
become_user: "{{ mailman3_web_user }}" become_user: "{{ mailman_web_user }}"
- name: Create Django superusers - name: Create Django superusers
django_manage: django_manage:
@ -122,17 +122,17 @@
from django.contrib.auth.models import User; from django.contrib.auth.models import User;
User.objects.create_superuser("{{ item.item.name }}", "{{ item.item.email }}", "{{ item.item.pass }}")' User.objects.create_superuser("{{ item.item.name }}", "{{ item.item.email }}", "{{ item.item.pass }}")'
#command: "createsuperuser --noinput --username={{ item.item.name }} --email={{ item.item.email }}" #command: "createsuperuser --noinput --username={{ item.item.name }} --email={{ item.item.email }}"
app_path: "{{ mailman3_django_project_dir }}" app_path: "{{ mailman_django_project_dir }}"
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
when: item is changed when: item is changed
with_items: "{{ __mailman3_checksuperuser_result.results }}" with_items: "{{ __mailman_checksuperuser_result.results }}"
register: __mailman3_createsuperuser_result register: __mailman_createsuperuser_result
changed_when: true changed_when: true
loop_control: loop_control:
label: "{{ item.item.name }}" label: "{{ item.item.name }}"
# FIXME: # FIXME:
become: yes become: yes
become_user: "{{ mailman3_web_user }}" become_user: "{{ mailman_web_user }}"
- name: Check Django sites - name: Check Django sites
django_manage: django_manage:
@ -140,55 +140,55 @@
shell -c 'import sys; shell -c 'import sys;
from django.contrib.sites.models import Site; from django.contrib.sites.models import Site;
sys.stdout.write("exists") if Site.objects.filter(domain="example.com").count() > 0 else sys.stdout.write("missing")' sys.stdout.write("exists") if Site.objects.filter(domain="example.com").count() > 0 else sys.stdout.write("missing")'
app_path: "{{ mailman3_django_project_dir }}" app_path: "{{ mailman_django_project_dir }}"
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
register: __mailman3_checkexamplesite_result register: __mailman_checkexamplesite_result
changed_when: __mailman3_checkexamplesite_result.out == "exists" changed_when: __mailman_checkexamplesite_result.out == "exists"
# FIXME: # FIXME:
become: yes become: yes
become_user: "{{ mailman3_web_user }}" become_user: "{{ mailman_web_user }}"
- name: Correct default Django site - name: Correct default Django site
django_manage: django_manage:
command: >- command: >-
shell -c 'from django.contrib.sites.models import Site; shell -c 'from django.contrib.sites.models import Site;
Site.objects.filter(domain="example.com").update( Site.objects.filter(domain="example.com").update(
domain="{{ (mailman3_domains | default([])).0 | default(inventory_hostname) }}", domain="{{ (mailman_domains | default([])).0 | default(inventory_hostname) }}",
name="{{ (mailman3_domains | default([])).0 | default(inventory_hostname) }}" name="{{ (mailman_domains | default([])).0 | default(inventory_hostname) }}"
)' )'
app_path: "{{ mailman3_django_project_dir }}" app_path: "{{ mailman_django_project_dir }}"
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
when: __mailman3_checkexamplesite_result is changed when: __mailman_checkexamplesite_result is changed
changed_when: true changed_when: true
# FIXME: # FIXME:
become: yes become: yes
become_user: "{{ mailman3_web_user }}" become_user: "{{ mailman_web_user }}"
# TODO: create additional domains (for right now the admin can do this in the UI) # TODO: create additional domains (for right now the admin can do this in the UI)
- name: Create/update uWSGI configuration file - name: Create/update uWSGI configuration file
template: template:
src: uwsgi.ini.j2 src: uwsgi.ini.j2
dest: "{{ mailman3_etc_dir }}/uwsgi.ini" dest: "{{ mailman_etc_dir }}/uwsgi.ini"
when: __mailman3_pip and mailman3_domains is not defined when: __mailman_pip and mailman_domains is not defined
notify: notify:
- restart mailman3-web service - restart mailman-web service
- name: Create/update uWSGI domain configuration files - name: Create/update uWSGI domain configuration files
template: template:
src: uwsgi.ini.j2 src: uwsgi.ini.j2
dest: "{{ mailman3_etc_dir }}/uwsgi_{{ domain }}.ini" dest: "{{ mailman_etc_dir }}/uwsgi_{{ domain }}.ini"
loop: "{{ mailman3_domains | default([]) }}" loop: "{{ mailman_domains | default([]) }}"
loop_control: loop_control:
index_var: site_id index_var: site_id
loop_var: domain loop_var: domain
when: mailman3_domains is defined when: mailman_domains is defined
notify: notify:
- restart mailman3-web service - restart mailman-web service
# This is idempotent so it's safe to do as an always-run task # This is idempotent so it's safe to do as an always-run task
- name: Compress CSS - name: Compress CSS
django_manage: django_manage:
app_path: "{{ mailman3_django_project_dir }}" app_path: "{{ mailman_django_project_dir }}"
command: compress command: compress
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"

View File

@ -3,22 +3,22 @@
- name: Install Ansible - name: Install Ansible
pip: pip:
name: ansible name: ansible
virtualenv: "{{ mailman3_distribute_maps_dir }}" virtualenv: "{{ mailman_distribute_maps_dir }}"
virtualenv_command: "{{ mailman3_virtualenv_command | default(omit) }}" virtualenv_command: "{{ mailman_virtualenv_command | default(omit) }}"
virtualenv_python: "{{ mailman3_virtualenv_python | default(omit) }}" virtualenv_python: "{{ mailman_virtualenv_python | default(omit) }}"
- name: Create playbook directory - name: Create playbook directory
file: file:
path: "{{ mailman3_distribute_maps_dir }}/etc" path: "{{ mailman_distribute_maps_dir }}/etc"
state: directory state: directory
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0750" mode: "0750"
- name: Create playbook files - name: Create playbook files
copy: copy:
src: "distribute_maps.{{ item }}" src: "distribute_maps.{{ item }}"
dest: "{{ mailman3_distribute_maps_dir }}/etc/{{ item }}" dest: "{{ mailman_distribute_maps_dir }}/etc/{{ item }}"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0640" mode: "0640"
loop: loop:
- playbook.yml - playbook.yml
@ -28,17 +28,17 @@
- name: Create hosts file - name: Create hosts file
template: template:
src: hosts.distribute_maps.j2 src: hosts.distribute_maps.j2
dest: "{{ mailman3_distribute_maps_dir }}/etc/hosts" dest: "{{ mailman_distribute_maps_dir }}/etc/hosts"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0640" mode: "0640"
- name: Create cron job - name: Create cron job
cron: cron:
name: Distribute Mailman 3 Postfix Maps name: Distribute Mailman 3 Postfix Maps
cron_file: ansible_mailman3_distribute_maps cron_file: ansible_mailman_distribute_maps
user: "{{ __mailman3_user_name }}" user: "{{ __mailman_user_name }}"
minute: "*/{{ mailman3_distribute_map_frequency | default(5) }}" minute: "*/{{ mailman_distribute_map_frequency | default(5) }}"
job: >- job: >-
cd {{ mailman3_distribute_maps_dir | quote }}/etc && cd {{ mailman_distribute_maps_dir | quote }}/etc &&
{{ mailman3_distribute_maps_dir | quote }}/bin/ansible-playbook playbook.yml {{ mailman_distribute_maps_dir | quote }}/bin/ansible-playbook playbook.yml
>>{{ mailman3_log_dir }}/distribute_maps.log 2>&1 >>{{ mailman_log_dir }}/distribute_maps.log 2>&1

View File

@ -3,13 +3,13 @@
- name: Get Mailman user group ID - name: Get Mailman user group ID
getent: getent:
database: passwd database: passwd
key: "{{ __mailman3_user_name }}" key: "{{ __mailman_user_name }}"
- name: Get Mailman user group name - name: Get Mailman user group name
getent: getent:
database: group database: group
key: "{{ getent_passwd[__mailman3_user_name][2] }}" key: "{{ getent_passwd[__mailman_user_name][2] }}"
- name: Set Mailman user group fact - name: Set Mailman user group fact
set_fact: set_fact:
__mailman3_group_name: "{{ getent_group | first }}" __mailman_group_name: "{{ getent_group | first }}"

View File

@ -5,7 +5,7 @@
that: that:
- "ansible_os_family == 'Debian'" - "ansible_os_family == 'Debian'"
success_msg: "OS is supported for Mailman 3 installation by package" success_msg: "OS is supported for Mailman 3 installation by package"
fail_msg: "OS is not supported for Mailman 3 installation by package, set `mailman3_install_method` to `pip`" fail_msg: "OS is not supported for Mailman 3 installation by package, set `mailman_install_method` to `pip`"
# TODO: everything below untested with Mailman 3 # TODO: everything below untested with Mailman 3
- name: Install debconf packages - name: Install debconf packages
@ -17,19 +17,19 @@
- name: Set client options in debconf - name: Set client options in debconf
debconf: debconf:
name: mailman3 name: mailman
question: "{{ item.question }}" question: "{{ item.question }}"
value: "{{ item.value }}" value: "{{ item.value }}"
vtype: "{{ item.vtype }}" vtype: "{{ item.vtype }}"
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
with_items: with_items:
- question: "mailman/site_languages" - question: "mailman/site_languages"
value: "{{ mailman3_language }}" value: "{{ mailman_language }}"
type: "multiselect" type: "multiselect"
- question: "mailman/default_server_language" - question: "mailman/default_server_language"
value: "{{ mailman3_language }}" value: "{{ mailman_language }}"
vtype: "multiselect" vtype: "multiselect"
- name: Install Mailman and dependency packages - name: Install Mailman and dependency packages
package: package:
name: "{{ mailman3_packages }}" name: "{{ mailman_packages }}"

View File

@ -2,22 +2,22 @@
- name: Install system dependencies - name: Install system dependencies
package: package:
name: "{{ mailman3_system_dependency_packages }}" name: "{{ mailman_system_dependency_packages }}"
when: mailman3_install_system_dependencies when: mailman_install_system_dependencies
# This is a separate task from the next one because `python3 -m venv` doesn't install wheel and pip needs it to build # This is a separate task from the next one because `python3 -m venv` doesn't install wheel and pip needs it to build
# wheels (not strictly required, but preferred) and won't load it mid-invocation if installed during the next task # wheels (not strictly required, but preferred) and won't load it mid-invocation if installed during the next task
- name: Create Mailman venv - name: Create Mailman venv
pip: pip:
name: wheel name: wheel
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
virtualenv_python: "{{ mailman3_virtualenv_python | default(omit) }}" virtualenv_python: "{{ mailman_virtualenv_python | default(omit) }}"
virtualenv_command: "{{ mailman3_virtualenv_command | default(omit) }}" virtualenv_command: "{{ mailman_virtualenv_command | default(omit) }}"
- name: Install Mailman and Python dependencies - name: Install Mailman and Python dependencies
pip: pip:
name: "{{ mailman3_packages + mailman3_extra_packages }}" name: "{{ mailman_packages + mailman_extra_packages }}"
virtualenv: "{{ mailman3_install_dir }}" virtualenv: "{{ mailman_install_dir }}"
- name: Create configuration, data, and state directories - name: Create configuration, data, and state directories
file: file:
@ -27,72 +27,72 @@
mode: "{{ item.mode | default(omit) }}" mode: "{{ item.mode | default(omit) }}"
state: directory state: directory
with_items: with_items:
- path: "{{ mailman3_etc_dir }}" - path: "{{ mailman_etc_dir }}"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0750" mode: "0750"
# Creates the parent /var/opt/mailman3 with default permissions # Creates the parent /var/opt/mailman with default permissions
- path: "{{ mailman3_var_dir | dirname }}" - path: "{{ mailman_var_dir | dirname }}"
- path: "{{ mailman3_var_dir }}" - path: "{{ mailman_var_dir }}"
owner: "{{ __mailman3_user_name }}" owner: "{{ __mailman_user_name }}"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0750" mode: "0750"
- path: "{{ mailman3_log_dir }}" - path: "{{ mailman_log_dir }}"
owner: "{{ __mailman3_user_name }}" owner: "{{ __mailman_user_name }}"
group: "{{ __mailman3_group_name }}" group: "{{ __mailman_group_name }}"
mode: "0750" mode: "0750"
- path: "{{ mailman3_django_var_dir }}" - path: "{{ mailman_django_var_dir }}"
- path: "{{ mailman3_django_var_dir }}/run" - path: "{{ mailman_django_var_dir }}/run"
owner: "{{ mailman3_web_user }}" owner: "{{ mailman_web_user }}"
group: "{{ mailman3_web_group }}" group: "{{ mailman_web_group }}"
mode: "0750" mode: "0750"
- path: "{{ mailman3_django_var_dir }}/db" - path: "{{ mailman_django_var_dir }}/db"
owner: "{{ mailman3_web_user }}" owner: "{{ mailman_web_user }}"
group: "{{ mailman3_web_group }}" group: "{{ mailman_web_group }}"
mode: "0750" mode: "0750"
- path: "{{ mailman3_django_var_dir }}/fulltext_index" - path: "{{ mailman_django_var_dir }}/fulltext_index"
owner: "{{ mailman3_web_user }}" owner: "{{ mailman_web_user }}"
group: "{{ mailman3_web_group }}" group: "{{ mailman_web_group }}"
mode: "0750" mode: "0750"
- path: "{{ mailman3_django_var_dir }}/emails" - path: "{{ mailman_django_var_dir }}/emails"
owner: "{{ mailman3_web_user }}" owner: "{{ mailman_web_user }}"
group: "{{ mailman3_web_group }}" group: "{{ mailman_web_group }}"
mode: "0750" mode: "0750"
- path: "{{ mailman3_django_project_dir }}" - path: "{{ mailman_django_project_dir }}"
group: "{{ mailman3_web_group }}" group: "{{ mailman_web_group }}"
mode: "0750" mode: "0750"
- path: "{{ mailman3_django_log_dir }}" - path: "{{ mailman_django_log_dir }}"
mode: "0750" mode: "0750"
owner: "{{ mailman3_web_user }}" owner: "{{ mailman_web_user }}"
group: "{{ mailman3_web_group }}" group: "{{ mailman_web_group }}"
- name: Create HyperKitty attachment directory - name: Create HyperKitty attachment directory
file: file:
path: "{{ __mailman3_django_config_merged.hyperkitty_attachment_folder }}" path: "{{ __mailman_django_config_merged.hyperkitty_attachment_folder }}"
owner: "{{ mailman3_web_user }}" owner: "{{ mailman_web_user }}"
group: "{{ mailman3_web_group }}" group: "{{ mailman_web_group }}"
mode: "0750" mode: "0750"
state: directory state: directory
when: __mailman3_django_config_merged.hyperkitty_attachment_folder is defined when: __mailman_django_config_merged.hyperkitty_attachment_folder is defined
# TODO: This is needed to read settings_local.py from /etc/opt/mailman3, but will it be needed for anything else? # TODO: This is needed to read settings_local.py from /etc/opt/mailman, but will it be needed for anything else?
# TODO: config option to control this? # TODO: config option to control this?
- name: Add web user to Mailman user group - name: Add web user to Mailman user group
user: user:
name: "{{ mailman3_web_user }}" name: "{{ mailman_web_user }}"
groups: "{{ __mailman3_group_name }}" groups: "{{ __mailman_group_name }}"
- name: Install systemd service unit files - name: Install systemd service unit files
template: template:
src: "{{ item.src | default(item) }}.j2" src: "{{ item.src | default(item) }}.j2"
dest: /etc/systemd/system/{{ item.dest | default(item) }} dest: /etc/systemd/system/{{ item.dest | default(item) }}
loop: loop:
- mailman3-core.service - mailman-core.service
- src: mailman3-web.service - src: mailman-web.service
dest: mailman3-web{{ '@' if mailman3_domains is defined else '' }}.service dest: mailman-web{{ '@' if mailman_domains is defined else '' }}.service
loop_control: loop_control:
label: "{{ item.dest | default(item) }}" label: "{{ item.dest | default(item) }}"
when: mailman3_process_manager == 'systemd' when: mailman_process_manager == 'systemd'
notify: notify:
- reload systemd manager configuration - reload systemd manager configuration
# TODO: remove the non-instance service unit file if mailman3_domains is defined, remove the instance service unit file # TODO: remove the non-instance service unit file if mailman_domains is defined, remove the instance service unit file

View File

@ -2,20 +2,20 @@
- name: Include user creation tasks - name: Include user creation tasks
include_tasks: user.yml include_tasks: user.yml
when: mailman3_create_user when: mailman_create_user
- name: Include group discovery tasks - name: Include group discovery tasks
import_tasks: group_discovery.yml import_tasks: group_discovery.yml
- name: Include installation tasks - name: Include installation tasks
import_tasks: "install_{{ mailman3_install_method }}.yml" import_tasks: "install_{{ mailman_install_method }}.yml"
- name: Include configuration tasks - name: Include configuration tasks
import_tasks: config.yml import_tasks: config.yml
- name: Include Postfix map distribution tasks - name: Include Postfix map distribution tasks
include_tasks: distribute_maps.yml include_tasks: distribute_maps.yml
when: mailman3_distribute_maps is defined when: mailman_distribute_maps is defined
# Perform whatever restarts are needed now, prevents double restart on first run # Perform whatever restarts are needed now, prevents double restart on first run
- name: Flush handlers - name: Flush handlers
@ -23,15 +23,15 @@
- name: Ensure Mailman Core is enabled and running - name: Ensure Mailman Core is enabled and running
service: service:
name: "{{ mailman3_core_service_name }}" name: "{{ mailman_core_service_name }}"
enabled: yes enabled: yes
state: started state: started
when: mailman3_process_manager != "supervisor" when: mailman_process_manager != "supervisor"
- name: Ensure Mailman Web is enabled and running - name: Ensure Mailman Web is enabled and running
service: service:
name: "{{ mailman3_web_service_name }}{{ '@' if mailman3_domains is defined else '' }}{{ item }}" name: "{{ mailman_web_service_name }}{{ '@' if mailman_domains is defined else '' }}{{ item }}"
enabled: yes enabled: yes
state: started state: started
loop: "{{ mailman3_domains | default(['']) }}" loop: "{{ mailman_domains | default(['']) }}"
when: mailman3_process_manager != "supervisor" when: mailman_process_manager != "supervisor"

View File

@ -1,20 +1,20 @@
--- ---
- name: Create mailman3 group - name: Create mailman group
group: group:
name: "{{ (mailman3_user | default({})).group }}" name: "{{ (mailman_user | default({})).group }}"
gid: "{{ (mailman3_user | default({})).gid | default(omit) }}" gid: "{{ (mailman_user | default({})).gid | default(omit) }}"
system: "{{ (mailman3_user | default({})).system | default('yes') }}" system: "{{ (mailman_user | default({})).system | default('yes') }}"
when: (mailman3_user | default({})).group is defined when: (mailman_user | default({})).group is defined
- name: Create mailman3 user - name: Create mailman user
user: user:
name: "{{ __mailman_user_name }}" name: "{{ __mailman_user_name }}"
comment: "{{ (mailman3_user | default({})).comment | default(omit) }}" comment: "{{ (mailman_user | default({})).comment | default(omit) }}"
uid: "{{ (mailman3_user | default({})).uid | default(omit) }}" uid: "{{ (mailman_user | default({})).uid | default(omit) }}"
group: "{{ (mailman3_user | default({})).group | default(omit) }}" group: "{{ (mailman_user | default({})).group | default(omit) }}"
groups: "{{ (mailman3_user | default({})).groups | default(omit) }}" groups: "{{ (mailman_user | default({})).groups | default(omit) }}"
home: "{{ (mailman3_user | default({})).home | default(mailman3_var_dir) }}" home: "{{ (mailman_user | default({})).home | default(mailman_var_dir) }}"
create_home: "{{ (mailman3_user | default({})).create_home | default('no') }}" create_home: "{{ (mailman_user | default({})).create_home | default('no') }}"
shell: "{{ (mailman3_user | default({})).shell | default(omit) }}" shell: "{{ (mailman_user | default({})).shell | default(omit) }}"
system: "{{ (mailman3_user | default({})).system | default('yes') }}" system: "{{ (mailman_user | default({})).system | default('yes') }}"

View File

@ -1,10 +1,10 @@
#jinja2: trim_blocks: False #jinja2: trim_blocks: False
{% for mx in mailman3_distribute_maps %}{% if mx.host != 'all' -%} {% for mx in mailman_distribute_maps %}{% if mx.host != 'all' -%}
{{ mx.host }}{% for opt in mx | sort %}{% if opt != 'host' %} {{ opt }}={{ mx[opt] }}{% endif %}{% endfor %} {{ mx.host }}{% for opt in mx | sort %}{% if opt != 'host' %} {{ opt }}={{ mx[opt] }}{% endif %}{% endfor %}
{% endif %}{% endfor %} {% endif %}{% endfor %}
[all:vars] [all:vars]
mailman3_var_dir = {{ mailman3_var_dir }} mailman_var_dir = {{ mailman_var_dir }}
{% set all_vars = mailman3_distribute_maps | selectattr("host", "eq", "all") | first -%} {% set all_vars = mailman_distribute_maps | selectattr("host", "eq", "all") | first -%}
{% if all_vars is defined -%} {% if all_vars is defined -%}
{% for opt in all_vars | sort %}{% if opt != 'host' -%} {% for opt in all_vars | sort %}{% if opt != 'host' -%}
{{ opt }} = {{ all_vars[opt] }} {{ opt }} = {{ all_vars[opt] }}

View File

@ -2,10 +2,10 @@
;; ;;
;; ;;
{% for section in __mailman3_config_merged | sort %} {% for section in __mailman_config_merged | sort %}
[{{ section }}] [{{ section }}]
{% for key in __mailman3_config_merged[section] | sort %} {% for key in __mailman_config_merged[section] | sort %}
{{ key }}: {{ __mailman3_config_merged[section][key] }} {{ key }}: {{ __mailman_config_merged[section][key] }}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}

View File

@ -2,16 +2,16 @@
Description=Mailman 3 Core service Description=Mailman 3 Core service
After=network.target After=network.target
Documentation=https://mailman.readthedocs.io/ Documentation=https://mailman.readthedocs.io/
ConditionPathExists={{ mailman3_etc_dir }}/mailman.cfg ConditionPathExists={{ mailman_etc_dir }}/mailman.cfg
[Service] [Service]
ExecStart={{ mailman3_install_dir }}/bin/mailman -C {{ mailman3_etc_dir }}/mailman.cfg start ExecStart={{ mailman_install_dir }}/bin/mailman -C {{ mailman_etc_dir }}/mailman.cfg start
ExecReload={{ mailman3_install_dir }}/bin/mailman -C {{ mailman3_etc_dir }}/mailman.cfg restart ExecReload={{ mailman_install_dir }}/bin/mailman -C {{ mailman_etc_dir }}/mailman.cfg restart
ExecStop={{ mailman3_install_dir }}/bin/mailman -C {{ mailman3_etc_dir }}/mailman.cfg stop ExecStop={{ mailman_install_dir }}/bin/mailman -C {{ mailman_etc_dir }}/mailman.cfg stop
Type=forking Type=forking
PIDFile={{ __mailman3_config_merged['paths.' ~ __mailman3_config_merged.mailman.layout].pid_file | default(mailman3_var_dir ~ '/master.pid') }} PIDFile={{ __mailman_config_merged['paths.' ~ __mailman_config_merged.mailman.layout].pid_file | default(mailman_var_dir ~ '/master.pid') }}
SyslogIdentifier=mailman3 SyslogIdentifier=mailman
User={{ __mailman3_user_name }} User={{ __mailman_user_name }}
Group={{ __mailman3_group_name }} Group={{ __mailman_group_name }}
[Install] [Install]

View File

@ -1,13 +1,13 @@
[Unit] [Unit]
Description=Mailman 3 Django/uWSGI {% if mailman3_domains is defined %}(domain %i) {% endif %}service Description=Mailman 3 Django/uWSGI {% if mailman_domains is defined %}(domain %i) {% endif %}service
After=network.target After=network.target
Documentation=https://mailman.readthedocs.io/ Documentation=https://mailman.readthedocs.io/
ConditionPathExists={{ mailman3_etc_dir }}/uwsgi{% if mailman3_domains is defined %}_%i{% endif %}.ini ConditionPathExists={{ mailman_etc_dir }}/uwsgi{% if mailman_domains is defined %}_%i{% endif %}.ini
[Service] [Service]
ExecStart={{ mailman3_install_dir }}/bin/{{ mailman3_python_uwsgi_package }} --ini {{ mailman3_etc_dir }}/uwsgi{% if mailman3_domains is defined %}_%i{% endif %}.ini ExecStart={{ mailman_install_dir }}/bin/{{ mailman_python_uwsgi_package }} --ini {{ mailman_etc_dir }}/uwsgi{% if mailman_domains is defined %}_%i{% endif %}.ini
{# https://github.com/unbit/uwsgi/issues/1980 #} {# https://github.com/unbit/uwsgi/issues/1980 #}
{% if mailman3_python_uwsgi_package == 'pyuwsgi' %} {% if mailman_python_uwsgi_package == 'pyuwsgi' %}
Environment=DJANGO_SETTINGS_MODULE=settings_%i Environment=DJANGO_SETTINGS_MODULE=settings_%i
{% endif %} {% endif %}
Restart=on-failure Restart=on-failure

View File

@ -1,4 +1,4 @@
#!{{ mailman3_install_dir }}/bin/python3 #!{{ mailman_install_dir }}/bin/python3
import os import os
import sys import sys

View File

@ -31,7 +31,7 @@ import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = {{ 'True' if (__mailman3_django_config_merged.debug | default(false) | bool) else 'False' }} DEBUG = {{ 'True' if (__mailman_django_config_merged.debug | default(false) | bool) else 'False' }}
# Application definition # Application definition
@ -44,7 +44,7 @@ MIDDLEWARE = (
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django_mailman3.middleware.TimezoneMiddleware', 'django_mailman.middleware.TimezoneMiddleware',
'postorius.middleware.PostoriusMiddleware', 'postorius.middleware.PostoriusMiddleware',
) )
@ -67,7 +67,7 @@ TEMPLATES = [
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'django_mailman3.context_processors.common', 'django_mailman.context_processors.common',
'hyperkitty.context_processors.common', 'hyperkitty.context_processors.common',
'postorius.context_processors.postorius', 'postorius.context_processors.postorius',
], ],
@ -108,7 +108,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Don't put anything in this directory yourself; store your static files # Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/" # Example: "/var/www/example.com/static/"
STATIC_ROOT = '{{ mailman3_django_static_dir }}' STATIC_ROOT = '{{ mailman_django_static_dir }}'
# URL prefix for static files. # URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/" # Example: "http://example.com/static/", "http://static.example.com/"
@ -183,8 +183,8 @@ COMPRESS_PRECOMPILERS = (
# #
HAYSTACK_CONNECTIONS = { HAYSTACK_CONNECTIONS = {
'default': { 'default': {
'ENGINE': '{{ mailman3_django_haystack_engine | default("haystack.backends.whoosh_backend.WhooshEngine") }}', 'ENGINE': '{{ mailman_django_haystack_engine | default("haystack.backends.whoosh_backend.WhooshEngine") }}',
'PATH': os.path.join("{{ mailman3_django_var_dir }}", "fulltext_index"), 'PATH': os.path.join("{{ mailman_django_var_dir }}", "fulltext_index"),
# You can also use the Xapian engine, it's faster and more accurate, # You can also use the Xapian engine, it's faster and more accurate,
# but requires another library. # but requires another library.
# http://django-haystack.readthedocs.io/en/v2.4.1/installing_search_engines.html#xapian # http://django-haystack.readthedocs.io/en/v2.4.1/installing_search_engines.html#xapian
@ -227,7 +227,7 @@ LOGGING = {
'level': 'INFO', 'level': 'INFO',
#'class': 'logging.handlers.RotatingFileHandler', #'class': 'logging.handlers.RotatingFileHandler',
'class': 'logging.handlers.WatchedFileHandler', 'class': 'logging.handlers.WatchedFileHandler',
'filename': os.path.join('{{ mailman3_django_log_dir }}', 'mailmansuite.log'), 'filename': os.path.join('{{ mailman_django_log_dir }}', 'mailmansuite.log'),
'formatter': 'verbose', 'formatter': 'verbose',
}, },
'console': { 'console': {
@ -287,8 +287,8 @@ LOGGING = {
# while you're fiddling with the code. # while you're fiddling with the code.
if DEBUG == True: if DEBUG == True:
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = os.path.join("{{ mailman3_django_var_dir }}", 'emails') EMAIL_FILE_PATH = os.path.join("{{ mailman_django_var_dir }}", 'emails')
# galaxyproject.mailman3: settings_local.py is required, no exception handling # galaxyproject.mailman: settings_local.py is required, no exception handling
from settings_local import * from settings_local import *

View File

@ -1,35 +1,35 @@
# This file is imported by the Mailman Suite. It is used to override # This file is imported by the Mailman Suite. It is used to override
# the default settings from {{ mailman3_django_project_dir }}/settings.py. # the default settings from {{ mailman_django_project_dir }}/settings.py.
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "{{ __mailman3_django_config_merged.secret_key | default('change-this-on-your-production-server') }}" SECRET_KEY = "{{ __mailman_django_config_merged.secret_key | default('change-this-on-your-production-server') }}"
ADMINS = ( ADMINS = (
{% for admin in __mailman3_django_config_merged.admins %} {% for admin in __mailman_django_config_merged.admins %}
('{{ admin.name }}', '{{ admin.email }}'), ('{{ admin.name }}', '{{ admin.email }}'),
{% endfor %} {% endfor %}
) )
# If using multiple domains, this value is overridden in {{ mailman3_django_project_dir }}/settings_DOMAIN.py # If using multiple domains, this value is overridden in {{ mailman_django_project_dir }}/settings_DOMAIN.py
SITE_ID = {{ __mailman3_django_config_merged.site_id | default(1) }} SITE_ID = {{ __mailman_django_config_merged.site_id | default(1) }}
# Hosts/domain names that are valid for this site; required if DEBUG is False # Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts # See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
"localhost", # Archiving API from Mailman, keep it. "localhost", # Archiving API from Mailman, keep it.
# Add here all production URLs you may have. # Add here all production URLs you may have.
{% for host in __mailman3_django_config_merged.allowed_hosts %} {% for host in __mailman_django_config_merged.allowed_hosts %}
"{{ host }}", "{{ host }}",
{% endfor %} {% endfor %}
] ]
# Mailman API credentials # Mailman API credentials
MAILMAN_REST_API_URL = '{{ __mailman3_django_config_merged.rest_api_url | default('http://localhost:8001') }}' MAILMAN_REST_API_URL = '{{ __mailman_django_config_merged.rest_api_url | default('http://localhost:8001') }}'
MAILMAN_REST_API_USER = '{{ __mailman3_django_config_merged.rest_api_user | default('restadmin') }}' MAILMAN_REST_API_USER = '{{ __mailman_django_config_merged.rest_api_user | default('restadmin') }}'
MAILMAN_REST_API_PASS = '{{ __mailman3_django_config_merged.rest_api_pass | default('restpass') }}' MAILMAN_REST_API_PASS = '{{ __mailman_django_config_merged.rest_api_pass | default('restpass') }}'
MAILMAN_ARCHIVER_KEY = '{{ __mailman3_django_config_merged.archiver_key | default('SecretArchiverAPIKey') }}' MAILMAN_ARCHIVER_KEY = '{{ __mailman_django_config_merged.archiver_key | default('SecretArchiverAPIKey') }}'
MAILMAN_ARCHIVER_FROM = ( MAILMAN_ARCHIVER_FROM = (
{% for host in __mailman3_django_config_merged.archiver_from | default(['127.0.0.1', '::1']) %} {% for host in __mailman_django_config_merged.archiver_from | default(['127.0.0.1', '::1']) %}
'{{ host }}', '{{ host }}',
{% endfor %} {% endfor %}
) )
@ -39,7 +39,7 @@ MAILMAN_ARCHIVER_FROM = (
INSTALLED_APPS = ( INSTALLED_APPS = (
'hyperkitty', 'hyperkitty',
'postorius', 'postorius',
'django_mailman3', 'django_mailman',
# Uncomment the next line to enable the admin: # Uncomment the next line to enable the admin:
'django.contrib.admin', 'django.contrib.admin',
# Uncomment the next line to enable admin documentation: # Uncomment the next line to enable admin documentation:
@ -59,8 +59,8 @@ INSTALLED_APPS = (
'allauth', 'allauth',
'allauth.account', 'allauth.account',
'allauth.socialaccount', 'allauth.socialaccount',
#'django_mailman3.lib.auth.fedora', #'django_mailman.lib.auth.fedora',
{% for provider in __mailman3_django_config_merged.socialaccount_providers | sort %} {% for provider in __mailman_django_config_merged.socialaccount_providers | sort %}
'allauth.socialaccount.providers.{{ provider }}', 'allauth.socialaccount.providers.{{ provider }}',
{% endfor %} {% endfor %}
) )
@ -70,10 +70,10 @@ INSTALLED_APPS = (
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = { DATABASES = {
{% for key in __mailman3_django_config_merged.databases | sort %} {% for key in __mailman_django_config_merged.databases | sort %}
'{{ key }}': { '{{ key }}': {
{% for opt in __mailman3_django_config_merged.databases[key] | sort %} {% for opt in __mailman_django_config_merged.databases[key] | sort %}
'{{ opt }}': '{{ __mailman3_django_config_merged.databases[key][opt] }}', '{{ opt }}': '{{ __mailman_django_config_merged.databases[key][opt] }}',
{% endfor %} {% endfor %}
} }
{% endfor %} {% endfor %}
@ -82,11 +82,11 @@ DATABASES = {
# If you're behind a proxy, use the X-Forwarded-Host header # If you're behind a proxy, use the X-Forwarded-Host header
# See https://docs.djangoproject.com/en/1.8/ref/settings/#use-x-forwarded-host # See https://docs.djangoproject.com/en/1.8/ref/settings/#use-x-forwarded-host
USE_X_FORWARDED_HOST = {{ 'True' if __mailman3_django_config_merged.use_x_forwarded_host | bool else 'False' }} USE_X_FORWARDED_HOST = {{ 'True' if __mailman_django_config_merged.use_x_forwarded_host | bool else 'False' }}
# And if your proxy does your SSL encoding for you, set SECURE_PROXY_SSL_HEADER # And if your proxy does your SSL encoding for you, set SECURE_PROXY_SSL_HEADER
# https://docs.djangoproject.com/en/1.8/ref/settings/#secure-proxy-ssl-header # https://docs.djangoproject.com/en/1.8/ref/settings/#secure-proxy-ssl-header
SECURE_PROXY_SSL_HEADER = ('{{ __mailman3_django_config_merged.secure_proxy_ssl_header }}', 'https') SECURE_PROXY_SSL_HEADER = ('{{ __mailman_django_config_merged.secure_proxy_ssl_header }}', 'https')
# Other security settings # Other security settings
# SECURE_SSL_REDIRECT = True # SECURE_SSL_REDIRECT = True
@ -106,9 +106,9 @@ SECURE_PROXY_SSL_HEADER = ('{{ __mailman3_django_config_merged.secure_proxy_ssl_
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/ # https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = '{{ mailman3_language_code }}' LANGUAGE_CODE = '{{ mailman_language_code }}'
TIME_ZONE = '{{ __mailman3_django_config_merged.time_zone | default("UTC") }}' TIME_ZONE = '{{ __mailman_django_config_merged.time_zone | default("UTC") }}'
USE_I18N = True USE_I18N = True
@ -121,13 +121,13 @@ USE_TZ = True
# will appear to be coming from. Make sure you set a valid domain name, # will appear to be coming from. Make sure you set a valid domain name,
# otherwise the emails may get rejected. # otherwise the emails may get rejected.
# https://docs.djangoproject.com/en/1.8/ref/settings/#default-from-email # https://docs.djangoproject.com/en/1.8/ref/settings/#default-from-email
DEFAULT_FROM_EMAIL = '{{ __mailman3_django_config_merged.default_from_email }}' DEFAULT_FROM_EMAIL = '{{ __mailman_django_config_merged.default_from_email }}'
# If you enable email reporting for error messages, this is where those emails # If you enable email reporting for error messages, this is where those emails
# will appear to be coming from. Make sure you set a valid domain name, # will appear to be coming from. Make sure you set a valid domain name,
# otherwise the emails may get rejected. # otherwise the emails may get rejected.
# https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-SERVER_EMAIL # https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-SERVER_EMAIL
SERVER_EMAIL = '{{ __mailman3_django_config_merged.server_email }}' SERVER_EMAIL = '{{ __mailman_django_config_merged.server_email }}'
# Change this when you have a real email backend # Change this when you have a real email backend
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
@ -139,12 +139,12 @@ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Django Allauth # Django Allauth
# You probably want https in production # You probably want https in production
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "{{ __mailman3_django_config_merged.default_http_protocol }}" ACCOUNT_DEFAULT_HTTP_PROTOCOL = "{{ __mailman_django_config_merged.default_http_protocol }}"
SOCIALACCOUNT_PROVIDERS = { SOCIALACCOUNT_PROVIDERS = {
{% for key in __mailman3_django_config_merged.socialaccount_providers | sort %} {% for key in __mailman_django_config_merged.socialaccount_providers | sort %}
{# This just dumps Ansible's Python representation of the value, which isn't ideal, but it probably works #} {# This just dumps Ansible's Python representation of the value, which isn't ideal, but it probably works #}
'{{ key }}': {{ __mailman3_django_config_merged.socialaccount_providers[key] }} '{{ key }}': {{ __mailman_django_config_merged.socialaccount_providers[key] }}
{% endfor %} {% endfor %}
} }
@ -176,7 +176,7 @@ SOCIALACCOUNT_PROVIDERS = {
# recompiled on each requests. It means running an additional "compress" # recompiled on each requests. It means running an additional "compress"
# management command after each code upgrade. # management command after each code upgrade.
# http://django-compressor.readthedocs.io/en/latest/usage/#offline-compression # http://django-compressor.readthedocs.io/en/latest/usage/#offline-compression
COMPRESS_OFFLINE = {{ 'True' if __mailman3_django_config_merged.compress_offline | bool else 'False' }} COMPRESS_OFFLINE = {{ 'True' if __mailman_django_config_merged.compress_offline | bool else 'False' }}
# Needed for debug mode # Needed for debug mode
# INTERNAL_IPS = ('127.0.0.1',) # INTERNAL_IPS = ('127.0.0.1',)
@ -199,8 +199,8 @@ COMPRESS_OFFLINE = {{ 'True' if __mailman3_django_config_merged.compress_offline
# Only display mailing-lists from the same virtual host as the webserver # Only display mailing-lists from the same virtual host as the webserver
FILTER_VHOST = False FILTER_VHOST = False
{% if __mailman3_django_config_merged.hyperkitty_attachment_folder is defined %} {% if __mailman_django_config_merged.hyperkitty_attachment_folder is defined %}
HYPERKITTY_ATTACHMENT_FOLDER = '{{ __mailman3_django_config_merged.hyperkitty_attachment_folder }}' HYPERKITTY_ATTACHMENT_FOLDER = '{{ __mailman_django_config_merged.hyperkitty_attachment_folder }}'
{% endif %} {% endif %}
POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost:8000' POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost:8000'

View File

@ -23,14 +23,14 @@ from django.urls import reverse_lazy
from django.views.generic import RedirectView from django.views.generic import RedirectView
urlpatterns = [ urlpatterns = [
{% if mailman3_postorius_root %} {% if mailman_postorius_root %}
url(r'^$', RedirectView.as_view( url(r'^$', RedirectView.as_view(
url=reverse_lazy('list_index'), url=reverse_lazy('list_index'),
permanent=True)), permanent=True)),
{% endif %} {% endif %}
url(r'^{{ mailman3_postorius_root }}', include('postorius.urls')), url(r'^{{ mailman_postorius_root }}', include('postorius.urls')),
url(r'^{{ mailman3_hyperkitty_root }}', include('hyperkitty.urls')), url(r'^{{ mailman_hyperkitty_root }}', include('hyperkitty.urls')),
url(r'', include('django_mailman3.urls')), url(r'', include('django_mailman.urls')),
url(r'^accounts/', include('allauth.urls')), url(r'^accounts/', include('allauth.urls')),
# Django admin # Django admin
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),

View File

@ -19,16 +19,16 @@ env = DJANGO_SETTINGS_MODULE=settings{{ '_' ~ domain | replace('.', '_') | repla
{% endif %} {% endif %}
# Port on which uwsgi will be listening. # Port on which uwsgi will be listening.
uwsgi-socket = {{ getsock(mailman3_uwsgi_socket) }} uwsgi-socket = {{ getsock(mailman_uwsgi_socket) }}
{% if mailman3_http_socket is defined %} {% if mailman_http_socket is defined %}
http-socket = {{ getsock(mailman3_http_socket) }} http-socket = {{ getsock(mailman_http_socket) }}
{% endif %} {% endif %}
# Enable threading for python # Enable threading for python
enable-threads = true enable-threads = true
# Move to the directory wher the django files are. # Move to the directory wher the django files are.
chdir = {{ mailman3_django_project_dir }} chdir = {{ mailman_django_project_dir }}
# Use the wsgi file provided with the django project. # Use the wsgi file provided with the django project.
wsgi-file = wsgi.py wsgi-file = wsgi.py
@ -39,15 +39,15 @@ process = 2
threads = 2 threads = 2
# Drop privielges and don't run as root. # Drop privielges and don't run as root.
uid = {{ mailman3_web_user }} uid = {{ mailman_web_user }}
gid = {{ mailman3_web_group }} gid = {{ mailman_web_group }}
virtualenv = {{ mailman3_install_dir }} virtualenv = {{ mailman_install_dir }}
# Setup the django_q related worker processes. # Setup the django_q related worker processes.
attach-daemon = ./manage.py qcluster attach-daemon = ./manage.py qcluster
{% if mailman3_domains is not defined or (site_id | default(-1)) == 0 %} {% if mailman_domains is not defined or (site_id | default(-1)) == 0 %}
# Setup hyperkitty's cron jobs. # Setup hyperkitty's cron jobs.
unique-cron = -1 -1 -1 -1 -1 ./manage.py runjobs minutely unique-cron = -1 -1 -1 -1 -1 ./manage.py runjobs minutely
unique-cron = -15 -1 -1 -1 -1 ./manage.py runjobs quarter_hourly unique-cron = -15 -1 -1 -1 -1 ./manage.py runjobs quarter_hourly
@ -58,21 +58,21 @@ unique-cron = 0 0 -1 -1 0 ./manage.py runjobs weekly
unique-cron = 0 0 1 1 -1 ./manage.py runjobs yearly unique-cron = 0 0 1 1 -1 ./manage.py runjobs yearly
{% endif %} {% endif %}
{% if mailman3_uwsgi_static %} {% if mailman_uwsgi_static %}
# Directly serve static content. # Directly serve static content.
static-map = /static={{ mailman3_django_static_dir }} static-map = /static={{ mailman_django_static_dir }}
{% endif %} {% endif %}
# Setup the request log. # Setup the request log.
req-logger = file:{{ mailman3_django_log_dir }}/uwsgi{{ '_' ~ domain if domain is defined else '' }}.log req-logger = file:{{ mailman_django_log_dir }}/uwsgi{{ '_' ~ domain if domain is defined else '' }}.log
# Log cron seperately. # Log cron seperately.
logger = cron file:{{ mailman3_django_log_dir }}/uwsgi-cron{{ '_' ~ domain if domain is defined else '' }}.log logger = cron file:{{ mailman_django_log_dir }}/uwsgi-cron{{ '_' ~ domain if domain is defined else '' }}.log
log-route = cron uwsgi-cron log-route = cron uwsgi-cron
# Log qcluster commands seperately. # Log qcluster commands seperately.
logger = qcluster file:{{ mailman3_django_log_dir }}/uwsgi-qcluster{{ '_' ~ domain if domain is defined else '' }}.log logger = qcluster file:{{ mailman_django_log_dir }}/uwsgi-qcluster{{ '_' ~ domain if domain is defined else '' }}.log
log-route = qcluster uwsgi-daemons log-route = qcluster uwsgi-daemons
# Last log and it logs the rest of the stuff. # Last log and it logs the rest of the stuff.
logger = file:{{ mailman3_django_log_dir }}/uwsgi-error{{ '_' ~ domain if domain is defined else '' }}.log logger = file:{{ mailman_django_log_dir }}/uwsgi-error{{ '_' ~ domain if domain is defined else '' }}.log