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?
mailman3_install_method: pip
mailman3_language: en
mailman3_language_code: en-us
mailman3_install_system_dependencies: "{{ __mailman3_debian or __mailman3_redhat }}"
mailman3_python_uwsgi_package: pyuwsgi
mailman3_backup_configs: false
mailman_install_method: pip
mailman_language: en
mailman_language_code: en-us
mailman_install_system_dependencies: "{{ __mailman_debian or __mailman_redhat }}"
mailman_python_uwsgi_package: pyuwsgi
mailman_backup_configs: false
# list of dicts with keys `name`, `email`, `pass`
mailman3_django_superusers: []
mailman_django_superusers: []
# list of hosted domains
#mailman3_domains: []
# If mailman3_domains is set, mailman3_config.default_from_email is ignored since it's assumed you want per-domain
#mailman_domains: []
# 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)
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
# addresses. Installs Ansible and a playbook in a virtualenv. User/auth setup is up to you.
#
# list of dicts, required keys:
# 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"
#mailman3_distribute_maps: []
mailman3_distribute_maps_dir: "{{ mailman3_var_dir }}/distribute_maps"
#mailman_distribute_maps: []
mailman_distribute_maps_dir: "{{ mailman_var_dir }}/distribute_maps"
# 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)
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
#mailman3_http_socket:
mailman3_uwsgi_static: no
#mailman_http_socket:
mailman_uwsgi_static: no
# You should rarely need to set these
#mailman3_virtualenv_python: python3
#mailman3_virtualenv_command: python3 -m venv # https://github.com/ansible/ansible/issues/52275
mailman3_virtualenv_command: pyvenv
#mailman_virtualenv_python: python3
#mailman_virtualenv_command: python3 -m venv # https://github.com/ansible/ansible/issues/52275
mailman_virtualenv_command: pyvenv
__mailman3_debian: "{{ ansible_os_family == 'Debian' }}"
__mailman3_redhat: "{{ ansible_os_family == 'RedHat' }}"
__mailman3_pip: "{{ mailman3_install_method == 'pip' }}"
__mailman_debian: "{{ ansible_os_family == 'Debian' }}"
__mailman_redhat: "{{ ansible_os_family == 'RedHat' }}"
__mailman_pip: "{{ mailman_install_method == 'pip' }}"
# pip needed packages if using the pip install method, system packages if using the package method
__mailman3_pip_packages:
__mailman_pip_packages:
- whoosh
- django>=1.11
- mailman
- postorius
- hyperkitty
- mailman-hyperkitty
- "{{ mailman3_python_uwsgi_package }}"
__mailman3_debian_packages:
- mailman3-full
__mailman3_redhat_packages: null # currently nonexistent
mailman3_packages: >-
- "{{ mailman_python_uwsgi_package }}"
__mailman_debian_packages:
- mailman-full
__mailman_redhat_packages: null # currently nonexistent
mailman_packages: >-
{{
__mailman3_pip_packages if __mailman3_pip else (
__mailman3_debian_packages if __mailman3_debian else
__mailman3_redhat_packages)
__mailman_pip_packages if __mailman_pip else (
__mailman_debian_packages if __mailman_debian else
__mailman_redhat_packages)
}}
# for e.g. psycopg2
mailman3_extra_packages: []
mailman_extra_packages: []
# 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-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
- sassc
- uwsgi
- uwsgi-plugin-python3
__mailman3_redhat_system_dependency_packages:
__mailman_redhat_system_dependency_packages:
# all require EPEL
- python36 # requires EL7+
- sassc
@ -84,149 +84,149 @@ __mailman3_redhat_system_dependency_packages:
# - rcssmin
# - rjsmin
# 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
__mailman3_redhat_system_dependency_packages
__mailman_debian_system_dependency_packages if __mailman_debian else
__mailman_redhat_system_dependency_packages
}}
# TODO: supervisor
mailman3_process_manager: >-
mailman_process_manager: >-
{{
'systemd' if ansible_virtualization_type != 'docker' else None
}}
mailman3_core_service_name: >-
mailman_core_service_name: >-
{{
'mailman3-core' if __mailman3_pip else (
'mailman3' if __mailman3_debian else
'mailman-core' if __mailman_pip else (
'mailman' if __mailman_debian else
None)
}}
mailman3_web_service_name: >-
mailman_web_service_name: >-
{{
'mailman3-web' if __mailman3_pip else (
'mailman3-web' if __mailman3_debian else
'mailman-web' if __mailman_pip else (
'mailman-web' if __mailman_debian else
None)
}}
mailman3_etc_dir: >-
mailman_etc_dir: >-
{{
'/etc/opt/mailman3' if __mailman3_pip else (
'/etc/mailman3' if __mailman3_debian else
'/opt/mailman/var/etc' if __mailman_pip else (
'/etc/mailman' if __mailman_debian else
None)
}}
mailman3_var_dir: >-
mailman_var_dir: >-
{{
'/var/opt/mailman3/core' if __mailman3_pip else (
'/var/lib/mailman3' if __mailman3_debian else
'/opt/mailman/var' if __mailman_pip else (
'/var/lib/mailman' if __mailman_debian else
None)
}}
mailman3_log_dir: >-
mailman_log_dir: >-
{{
'/var/opt/mailman3/core/log' if __mailman3_pip else (
'/var/log/mailman3' if __mailman3_debian else
'/opt/mailman/var/log' if __mailman_pip else (
'/var/log/mailman' if __mailman_debian else
None)
}}
mailman3_django_var_dir: >-
mailman_django_var_dir: >-
{{
'/var/opt/mailman3/web' if __mailman3_pip else (
'/var/lib/mailman3' if __mailman3_debian else
'/var/opt/mailman/web' if __mailman_pip else (
'/var/lib/mailman' if __mailman_debian else
None)
}}
mailman3_django_project_dir: >-
mailman_django_project_dir: >-
{{
'/var/opt/mailman3/web/project' if __mailman3_pip else (
'/usr/share/mailman3-web' if __mailman3_debian else
'/var/opt/mailman/web/project' if __mailman_pip else (
'/usr/share/mailman-web' if __mailman_debian else
None)
}}
mailman3_django_static_dir: >-
mailman_django_static_dir: >-
{{
'/var/opt/mailman3/web/static' if __mailman3_pip else (
'/var/lib/mailman3/web/static' if __mailman3_debian else
'/var/opt/mailman/web/static' if __mailman_pip else (
'/var/lib/mailman/web/static' if __mailman_debian else
None)
}}
mailman3_django_log_dir: >-
mailman_django_log_dir: >-
{{
'/var/opt/mailman3/web/log' if __mailman3_pip else (
'/var/log/mailman3/web' if __mailman3_debian else
'/var/opt/mailman/web/log' if __mailman_pip else (
'/var/log/mailman/web' if __mailman_debian else
None)
}}
mailman3_django_settings_file: >-
mailman_django_settings_file: >-
{{
'/etc/opt/mailman3/django-settings.py' if __mailman3_pip else (
'/etc/mailman3/mailman-web.py' if __mailman3_debian else
'/opt/mailman/django-settings.py' if __mailman_pip else (
'/etc/mailman/mailman-web.py' if __mailman_debian else
None)
}}
mailman3_web_user: >-
mailman_web_user: >-
{{
'www-data' if __mailman3_debian else (
'www-data' if __mailman_debian else (
None)
}}
# TODO:
#'httpd' if __mailman3_redhat and apache
#'nginx' if __mailman3_redhat and nginx
#'httpd' if __mailman_redhat and apache
#'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)
}}
mailman3_core_api_hostname: localhost
mailman3_core_api_port: 8001
mailman3_core_api_admin_user: restadmin
mailman3_core_api_admin_pass: restpass
mailman3_archiver_key: SecretArchiverAPIKey
mailman_core_api_hostname: localhost
mailman_core_api_port: 8001
mailman_core_api_admin_user: restadmin
mailman_core_api_admin_pass: restpass
mailman_archiver_key: SecretArchiverAPIKey
__mailman3_config_default:
__mailman_config_default:
mailman:
layout: custom
paths.custom:
var_dir: "{{ mailman3_var_dir }}"
var_dir: "{{ mailman_var_dir }}"
bin_dir: "$argv"
log_dir: "{{ mailman3_log_dir }}"
lock_dir: "{{ mailman3_var_dir }}/locks"
data_dir: "{{ mailman3_var_dir }}/data"
cache_dir: "{{ mailman3_var_dir }}/cache"
etc_dir: "{{ mailman3_etc_dir }}"
messages_dir: "{{ mailman3_var_dir }}/messages"
archives_dir: "{{ mailman3_var_dir }}/archives"
template_dir: "{{ mailman3_var_dir }}/templates"
pid_file: "{{ mailman3_var_dir }}/master.pid"
lock_file: "{{ mailman3_var_dir }}/master.lck"
log_dir: "{{ mailman_log_dir }}"
lock_dir: "{{ mailman_var_dir }}/locks"
data_dir: "{{ mailman_var_dir }}/data"
cache_dir: "{{ mailman_var_dir }}/cache"
etc_dir: "{{ mailman_etc_dir }}"
messages_dir: "{{ mailman_var_dir }}/messages"
archives_dir: "{{ mailman_var_dir }}/archives"
template_dir: "{{ mailman_var_dir }}/templates"
pid_file: "{{ mailman_var_dir }}/master.pid"
lock_file: "{{ mailman_var_dir }}/master.lck"
webservice:
hostname: "{{ mailman3_core_api_hostname }}"
port: "{{ mailman3_core_api_port }}"
hostname: "{{ mailman_core_api_hostname }}"
port: "{{ mailman_core_api_port }}"
use_https: "no"
admin_user: "{{ mailman3_core_api_admin_user }}"
admin_pass: "{{ mailman3_core_api_admin_pass }}"
admin_user: "{{ mailman_core_api_admin_user }}"
admin_pass: "{{ mailman_core_api_admin_pass }}"
api_version: "3.1"
archiver.hyperkitty:
class: mailman_hyperkitty.Archiver
enable: "yes"
configuration: "{{ mailman3_etc_dir }}/hyperkitty.cfg"
__mailman3_config_merged: "{{ __mailman3_config_default | combine(mailman3_config | default({}), recursive=True) }}"
configuration: "{{ mailman_etc_dir }}/hyperkitty.cfg"
__mailman_config_merged: "{{ __mailman_config_default | combine(mailman_config | default({}), recursive=True) }}"
__mailman3_django_config_default:
admins: "{{ mailman3_django_superusers }}"
allowed_hosts: "{{ mailman3_domains | default([inventory_hostname]) }}"
rest_api_url: "http://{{ mailman3_core_api_hostname }}:{{ mailman3_core_api_port }}"
rest_api_user: "{{ mailman3_core_api_admin_user }}"
rest_api_pass: "{{ mailman3_core_api_admin_pass }}"
archiver_key: "{{ mailman3_archiver_key }}"
__mailman_django_config_default:
admins: "{{ mailman_django_superusers }}"
allowed_hosts: "{{ mailman_domains | default([inventory_hostname]) }}"
rest_api_url: "http://{{ mailman_core_api_hostname }}:{{ mailman_core_api_port }}"
rest_api_user: "{{ mailman_core_api_admin_user }}"
rest_api_pass: "{{ mailman_core_api_admin_pass }}"
archiver_key: "{{ mailman_archiver_key }}"
databases:
default:
ENGINE: django.db.backends.sqlite3
NAME: "{{ mailman3_django_var_dir }}/db/mailmansuite.db"
NAME: "{{ mailman_django_var_dir }}/db/mailmansuite.db"
USER: ''
PASSWORD: ''
HOST: ''
@ -239,18 +239,18 @@ __mailman3_django_config_default:
server_email: root@{{ inventory_hostname }}
compress_offline: true
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/'
mailman3_hyperkitty_root: 'hyperkitty/'
mailman_postorius_root: 'postorius/'
mailman_hyperkitty_root: 'hyperkitty/'
#mailman3_user: mailman
mailman3_create_user: "{{ __mailman3_pip and not __mailman3_debian }}"
#mailman_user: mailman
mailman_create_user: "{{ __mailman_pip and not __mailman_debian }}"
__mailman3_debian_user_name: list
__mailman3_user_name: >-
__mailman_debian_user_name: list
__mailman_user_name: >-
{{
(mailman3_user | default({})).name | default(
__mailman3_debian_user_name if __mailman3_debian else
(mailman_user | default({})).name | default(
__mailman_debian_user_name if __mailman_debian else
'mailman')
}}

View File

@ -5,17 +5,17 @@
tasks:
- name: Check postfix_lmtp
stat:
path: "{{ mailman3_var_dir }}/data/postfix_lmtp"
path: "{{ mailman_var_dir }}/data/postfix_lmtp"
register: result
delegate_to: localhost
run_once: true
- name: Copy postfix_lmtp
copy:
src: "{{ mailman3_var_dir }}/data/postfix_lmtp"
dest: "{{ mailman3_distribute_maps_dir }}/postfix_lmtp"
src: "{{ mailman_var_dir }}/data/postfix_lmtp"
dest: "{{ mailman_distribute_maps_dir }}/postfix_lmtp"
when: result.stat.exists
notify:
- postmap
handlers:
- 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:
daemon_reload: yes
- name: restart mailman3-core service
- name: restart mailman-core service
service:
name: "{{ mailman3_core_service_name }}"
name: "{{ mailman_core_service_name }}"
state: restarted
when: ansible_virtualization_type != "docker"
- name: restart mailman3-web service
- name: restart mailman-web 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
loop: "{{ mailman3_domains | default(['']) }}"
loop: "{{ mailman_domains | default(['']) }}"
when: ansible_virtualization_type != "docker"

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
that:
- "ansible_os_family == 'Debian'"
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
- name: Install debconf packages
@ -17,19 +17,19 @@
- name: Set client options in debconf
debconf:
name: mailman3
name: mailman
question: "{{ item.question }}"
value: "{{ item.value }}"
vtype: "{{ item.vtype }}"
when: ansible_os_family == "Debian"
with_items:
- question: "mailman/site_languages"
value: "{{ mailman3_language }}"
value: "{{ mailman_language }}"
type: "multiselect"
- question: "mailman/default_server_language"
value: "{{ mailman3_language }}"
value: "{{ mailman_language }}"
vtype: "multiselect"
- name: Install Mailman and dependency packages
package:
name: "{{ mailman3_packages }}"
name: "{{ mailman_packages }}"

View File

@ -2,22 +2,22 @@
- name: Install system dependencies
package:
name: "{{ mailman3_system_dependency_packages }}"
when: mailman3_install_system_dependencies
name: "{{ mailman_system_dependency_packages }}"
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
# wheels (not strictly required, but preferred) and won't load it mid-invocation if installed during the next task
- name: Create Mailman venv
pip:
name: wheel
virtualenv: "{{ mailman3_install_dir }}"
virtualenv_python: "{{ mailman3_virtualenv_python | default(omit) }}"
virtualenv_command: "{{ mailman3_virtualenv_command | default(omit) }}"
virtualenv: "{{ mailman_install_dir }}"
virtualenv_python: "{{ mailman_virtualenv_python | default(omit) }}"
virtualenv_command: "{{ mailman_virtualenv_command | default(omit) }}"
- name: Install Mailman and Python dependencies
pip:
name: "{{ mailman3_packages + mailman3_extra_packages }}"
virtualenv: "{{ mailman3_install_dir }}"
name: "{{ mailman_packages + mailman_extra_packages }}"
virtualenv: "{{ mailman_install_dir }}"
- name: Create configuration, data, and state directories
file:
@ -27,72 +27,72 @@
mode: "{{ item.mode | default(omit) }}"
state: directory
with_items:
- path: "{{ mailman3_etc_dir }}"
group: "{{ __mailman3_group_name }}"
- path: "{{ mailman_etc_dir }}"
group: "{{ __mailman_group_name }}"
mode: "0750"
# Creates the parent /var/opt/mailman3 with default permissions
- path: "{{ mailman3_var_dir | dirname }}"
- path: "{{ mailman3_var_dir }}"
owner: "{{ __mailman3_user_name }}"
group: "{{ __mailman3_group_name }}"
# Creates the parent /var/opt/mailman with default permissions
- path: "{{ mailman_var_dir | dirname }}"
- path: "{{ mailman_var_dir }}"
owner: "{{ __mailman_user_name }}"
group: "{{ __mailman_group_name }}"
mode: "0750"
- path: "{{ mailman3_log_dir }}"
owner: "{{ __mailman3_user_name }}"
group: "{{ __mailman3_group_name }}"
- path: "{{ mailman_log_dir }}"
owner: "{{ __mailman_user_name }}"
group: "{{ __mailman_group_name }}"
mode: "0750"
- path: "{{ mailman3_django_var_dir }}"
- path: "{{ mailman3_django_var_dir }}/run"
owner: "{{ mailman3_web_user }}"
group: "{{ mailman3_web_group }}"
- path: "{{ mailman_django_var_dir }}"
- path: "{{ mailman_django_var_dir }}/run"
owner: "{{ mailman_web_user }}"
group: "{{ mailman_web_group }}"
mode: "0750"
- path: "{{ mailman3_django_var_dir }}/db"
owner: "{{ mailman3_web_user }}"
group: "{{ mailman3_web_group }}"
- path: "{{ mailman_django_var_dir }}/db"
owner: "{{ mailman_web_user }}"
group: "{{ mailman_web_group }}"
mode: "0750"
- path: "{{ mailman3_django_var_dir }}/fulltext_index"
owner: "{{ mailman3_web_user }}"
group: "{{ mailman3_web_group }}"
- path: "{{ mailman_django_var_dir }}/fulltext_index"
owner: "{{ mailman_web_user }}"
group: "{{ mailman_web_group }}"
mode: "0750"
- path: "{{ mailman3_django_var_dir }}/emails"
owner: "{{ mailman3_web_user }}"
group: "{{ mailman3_web_group }}"
- path: "{{ mailman_django_var_dir }}/emails"
owner: "{{ mailman_web_user }}"
group: "{{ mailman_web_group }}"
mode: "0750"
- path: "{{ mailman3_django_project_dir }}"
group: "{{ mailman3_web_group }}"
- path: "{{ mailman_django_project_dir }}"
group: "{{ mailman_web_group }}"
mode: "0750"
- path: "{{ mailman3_django_log_dir }}"
- path: "{{ mailman_django_log_dir }}"
mode: "0750"
owner: "{{ mailman3_web_user }}"
group: "{{ mailman3_web_group }}"
owner: "{{ mailman_web_user }}"
group: "{{ mailman_web_group }}"
- name: Create HyperKitty attachment directory
file:
path: "{{ __mailman3_django_config_merged.hyperkitty_attachment_folder }}"
owner: "{{ mailman3_web_user }}"
group: "{{ mailman3_web_group }}"
path: "{{ __mailman_django_config_merged.hyperkitty_attachment_folder }}"
owner: "{{ mailman_web_user }}"
group: "{{ mailman_web_group }}"
mode: "0750"
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?
- name: Add web user to Mailman user group
user:
name: "{{ mailman3_web_user }}"
groups: "{{ __mailman3_group_name }}"
name: "{{ mailman_web_user }}"
groups: "{{ __mailman_group_name }}"
- name: Install systemd service unit files
template:
src: "{{ item.src | default(item) }}.j2"
dest: /etc/systemd/system/{{ item.dest | default(item) }}
loop:
- mailman3-core.service
- src: mailman3-web.service
dest: mailman3-web{{ '@' if mailman3_domains is defined else '' }}.service
- mailman-core.service
- src: mailman-web.service
dest: mailman-web{{ '@' if mailman_domains is defined else '' }}.service
loop_control:
label: "{{ item.dest | default(item) }}"
when: mailman3_process_manager == 'systemd'
when: mailman_process_manager == 'systemd'
notify:
- 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
include_tasks: user.yml
when: mailman3_create_user
when: mailman_create_user
- name: Include group discovery tasks
import_tasks: group_discovery.yml
- name: Include installation tasks
import_tasks: "install_{{ mailman3_install_method }}.yml"
import_tasks: "install_{{ mailman_install_method }}.yml"
- name: Include configuration tasks
import_tasks: config.yml
- name: Include Postfix map distribution tasks
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
- name: Flush handlers
@ -23,15 +23,15 @@
- name: Ensure Mailman Core is enabled and running
service:
name: "{{ mailman3_core_service_name }}"
name: "{{ mailman_core_service_name }}"
enabled: yes
state: started
when: mailman3_process_manager != "supervisor"
when: mailman_process_manager != "supervisor"
- name: Ensure Mailman Web is enabled and running
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
state: started
loop: "{{ mailman3_domains | default(['']) }}"
when: mailman3_process_manager != "supervisor"
loop: "{{ mailman_domains | default(['']) }}"
when: mailman_process_manager != "supervisor"

View File

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

View File

@ -1,10 +1,10 @@
#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 %}
{% endif %}{% endfor %}
[all:vars]
mailman3_var_dir = {{ mailman3_var_dir }}
{% set all_vars = mailman3_distribute_maps | selectattr("host", "eq", "all") | first -%}
mailman_var_dir = {{ mailman_var_dir }}
{% set all_vars = mailman_distribute_maps | selectattr("host", "eq", "all") | first -%}
{% if all_vars is defined -%}
{% for opt in all_vars | sort %}{% if opt != 'host' -%}
{{ 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 }}]
{% for key in __mailman3_config_merged[section] | sort %}
{{ key }}: {{ __mailman3_config_merged[section][key] }}
{% for key in __mailman_config_merged[section] | sort %}
{{ key }}: {{ __mailman_config_merged[section][key] }}
{% endfor %}
{% endfor %}

View File

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

View File

@ -1,13 +1,13 @@
[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
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]
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 #}
{% if mailman3_python_uwsgi_package == 'pyuwsgi' %}
{% if mailman_python_uwsgi_package == 'pyuwsgi' %}
Environment=DJANGO_SETTINGS_MODULE=settings_%i
{% endif %}
Restart=on-failure

View File

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

View File

@ -31,7 +31,7 @@ import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# 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
@ -44,7 +44,7 @@ MIDDLEWARE = (
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django_mailman3.middleware.TimezoneMiddleware',
'django_mailman.middleware.TimezoneMiddleware',
'postorius.middleware.PostoriusMiddleware',
)
@ -67,7 +67,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django_mailman3.context_processors.common',
'django_mailman.context_processors.common',
'hyperkitty.context_processors.common',
'postorius.context_processors.postorius',
],
@ -108,7 +108,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = '{{ mailman3_django_static_dir }}'
STATIC_ROOT = '{{ mailman_django_static_dir }}'
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
@ -183,8 +183,8 @@ COMPRESS_PRECOMPILERS = (
#
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': '{{ mailman3_django_haystack_engine | default("haystack.backends.whoosh_backend.WhooshEngine") }}',
'PATH': os.path.join("{{ mailman3_django_var_dir }}", "fulltext_index"),
'ENGINE': '{{ mailman_django_haystack_engine | default("haystack.backends.whoosh_backend.WhooshEngine") }}',
'PATH': os.path.join("{{ mailman_django_var_dir }}", "fulltext_index"),
# You can also use the Xapian engine, it's faster and more accurate,
# but requires another library.
# http://django-haystack.readthedocs.io/en/v2.4.1/installing_search_engines.html#xapian
@ -227,7 +227,7 @@ LOGGING = {
'level': 'INFO',
#'class': 'logging.handlers.RotatingFileHandler',
'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',
},
'console': {
@ -287,8 +287,8 @@ LOGGING = {
# while you're fiddling with the code.
if DEBUG == True:
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 *

View File

@ -1,35 +1,35 @@
# 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!
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 = (
{% for admin in __mailman3_django_config_merged.admins %}
{% for admin in __mailman_django_config_merged.admins %}
('{{ admin.name }}', '{{ admin.email }}'),
{% endfor %}
)
# If using multiple domains, this value is overridden in {{ mailman3_django_project_dir }}/settings_DOMAIN.py
SITE_ID = {{ __mailman3_django_config_merged.site_id | default(1) }}
# If using multiple domains, this value is overridden in {{ mailman_django_project_dir }}/settings_DOMAIN.py
SITE_ID = {{ __mailman_django_config_merged.site_id | default(1) }}
# 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
ALLOWED_HOSTS = [
"localhost", # Archiving API from Mailman, keep it.
# 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 }}",
{% endfor %}
]
# Mailman API credentials
MAILMAN_REST_API_URL = '{{ __mailman3_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_PASS = '{{ __mailman3_django_config_merged.rest_api_pass | default('restpass') }}'
MAILMAN_ARCHIVER_KEY = '{{ __mailman3_django_config_merged.archiver_key | default('SecretArchiverAPIKey') }}'
MAILMAN_REST_API_URL = '{{ __mailman_django_config_merged.rest_api_url | default('http://localhost:8001') }}'
MAILMAN_REST_API_USER = '{{ __mailman_django_config_merged.rest_api_user | default('restadmin') }}'
MAILMAN_REST_API_PASS = '{{ __mailman_django_config_merged.rest_api_pass | default('restpass') }}'
MAILMAN_ARCHIVER_KEY = '{{ __mailman_django_config_merged.archiver_key | default('SecretArchiverAPIKey') }}'
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 }}',
{% endfor %}
)
@ -39,7 +39,7 @@ MAILMAN_ARCHIVER_FROM = (
INSTALLED_APPS = (
'hyperkitty',
'postorius',
'django_mailman3',
'django_mailman',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
@ -59,8 +59,8 @@ INSTALLED_APPS = (
'allauth',
'allauth.account',
'allauth.socialaccount',
#'django_mailman3.lib.auth.fedora',
{% for provider in __mailman3_django_config_merged.socialaccount_providers | sort %}
#'django_mailman.lib.auth.fedora',
{% for provider in __mailman_django_config_merged.socialaccount_providers | sort %}
'allauth.socialaccount.providers.{{ provider }}',
{% endfor %}
)
@ -70,10 +70,10 @@ INSTALLED_APPS = (
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
{% for key in __mailman3_django_config_merged.databases | sort %}
{% for key in __mailman_django_config_merged.databases | sort %}
'{{ key }}': {
{% for opt in __mailman3_django_config_merged.databases[key] | sort %}
'{{ opt }}': '{{ __mailman3_django_config_merged.databases[key][opt] }}',
{% for opt in __mailman_django_config_merged.databases[key] | sort %}
'{{ opt }}': '{{ __mailman_django_config_merged.databases[key][opt] }}',
{% endfor %}
}
{% endfor %}
@ -82,11 +82,11 @@ DATABASES = {
# 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
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
# 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
# SECURE_SSL_REDIRECT = True
@ -106,9 +106,9 @@ SECURE_PROXY_SSL_HEADER = ('{{ __mailman3_django_config_merged.secure_proxy_ssl_
# Internationalization
# 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
@ -121,13 +121,13 @@ USE_TZ = True
# will appear to be coming from. Make sure you set a valid domain name,
# otherwise the emails may get rejected.
# 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
# will appear to be coming from. Make sure you set a valid domain name,
# otherwise the emails may get rejected.
# 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
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
@ -139,12 +139,12 @@ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Django Allauth
# 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 = {
{% 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 #}
'{{ key }}': {{ __mailman3_django_config_merged.socialaccount_providers[key] }}
'{{ key }}': {{ __mailman_django_config_merged.socialaccount_providers[key] }}
{% endfor %}
}
@ -176,7 +176,7 @@ SOCIALACCOUNT_PROVIDERS = {
# recompiled on each requests. It means running an additional "compress"
# management command after each code upgrade.
# 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
# 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
FILTER_VHOST = False
{% if __mailman3_django_config_merged.hyperkitty_attachment_folder is defined %}
HYPERKITTY_ATTACHMENT_FOLDER = '{{ __mailman3_django_config_merged.hyperkitty_attachment_folder }}'
{% if __mailman_django_config_merged.hyperkitty_attachment_folder is defined %}
HYPERKITTY_ATTACHMENT_FOLDER = '{{ __mailman_django_config_merged.hyperkitty_attachment_folder }}'
{% endif %}
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
urlpatterns = [
{% if mailman3_postorius_root %}
{% if mailman_postorius_root %}
url(r'^$', RedirectView.as_view(
url=reverse_lazy('list_index'),
permanent=True)),
{% endif %}
url(r'^{{ mailman3_postorius_root }}', include('postorius.urls')),
url(r'^{{ mailman3_hyperkitty_root }}', include('hyperkitty.urls')),
url(r'', include('django_mailman3.urls')),
url(r'^{{ mailman_postorius_root }}', include('postorius.urls')),
url(r'^{{ mailman_hyperkitty_root }}', include('hyperkitty.urls')),
url(r'', include('django_mailman.urls')),
url(r'^accounts/', include('allauth.urls')),
# Django admin
url(r'^admin/', admin.site.urls),

View File

@ -19,16 +19,16 @@ env = DJANGO_SETTINGS_MODULE=settings{{ '_' ~ domain | replace('.', '_') | repla
{% endif %}
# Port on which uwsgi will be listening.
uwsgi-socket = {{ getsock(mailman3_uwsgi_socket) }}
{% if mailman3_http_socket is defined %}
http-socket = {{ getsock(mailman3_http_socket) }}
uwsgi-socket = {{ getsock(mailman_uwsgi_socket) }}
{% if mailman_http_socket is defined %}
http-socket = {{ getsock(mailman_http_socket) }}
{% endif %}
# Enable threading for python
enable-threads = true
# 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.
wsgi-file = wsgi.py
@ -39,15 +39,15 @@ process = 2
threads = 2
# Drop privielges and don't run as root.
uid = {{ mailman3_web_user }}
gid = {{ mailman3_web_group }}
uid = {{ mailman_web_user }}
gid = {{ mailman_web_group }}
virtualenv = {{ mailman3_install_dir }}
virtualenv = {{ mailman_install_dir }}
# Setup the django_q related worker processes.
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.
unique-cron = -1 -1 -1 -1 -1 ./manage.py runjobs minutely
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
{% endif %}
{% if mailman3_uwsgi_static %}
{% if mailman_uwsgi_static %}
# Directly serve static content.
static-map = /static={{ mailman3_django_static_dir }}
static-map = /static={{ mailman_django_static_dir }}
{% endif %}
# 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.
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 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
# 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