File tree 12 files changed +170
-24
lines changed
12 files changed +170
-24
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : ansible-lint-local
3
+
4
+ on :
5
+ pull_request :
6
+ push :
7
+ branches :
8
+ - master
9
+ - develop
10
+ - feature/**
11
+ jobs :
12
+ ansible-lint-local :
13
+ name : ansible-lint-local
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - name : Check out the codebase.
17
+ uses : actions/checkout@v3
18
+
19
+ - name : Set up Python 3.
20
+ uses : actions/setup-python@v3
21
+ with :
22
+ python-version : ' 3.x'
23
+
24
+ - name : Install test dependencies.
25
+ run : pip3 install yamllint ansible-lint ansible
26
+
27
+ - name : Lint code.
28
+ run : |
29
+ set -e
30
+ yamllint .
31
+ ansible-lint .
Original file line number Diff line number Diff line change
1
+ ---
1
2
name : ansible-lint
2
3
on : [pull_request_target]
3
4
jobs :
4
5
ansible-lint :
5
6
name : ansible-lint
6
7
runs-on : ubuntu-latest
7
8
steps :
8
- - uses : actions/checkout@v2
9
+ - uses : actions/checkout@v3
9
10
10
- - uses : actions/setup-python@v2
11
+ - uses : actions/setup-python@v3
11
12
with :
12
13
python-version : ' 3.x'
13
14
Original file line number Diff line number Diff line change
1
+ ---
2
+ extends: default
3
+ rules:
4
+ line-length:
5
+ max: 400
6
+ level: warning
7
+ truthy:
8
+ allowed-values:
9
+ - 'true'
10
+ - 'false'
11
+ check-keys: true
12
+ ignore: |
13
+ .github/workflows
Original file line number Diff line number Diff line change @@ -426,3 +426,10 @@ __mailman3_os: >-
426
426
ansible_os_family
427
427
) | lower
428
428
}}
429
+
430
+ # Server name nginx should listen on, defaults to inventory_hostname.
431
+ mailman3_web_url : " {{ inventory_hostname }}"
432
+ mailman3_install_nginx : true
433
+ # Override this will a value similar to mailman3_web_url. Used in /etc/mailman3/hyperkitty.cfg:
434
+ mailman3_hyperkitty_server_url : " http://localhost"
435
+ mailman3_nginx_ssl_certs : " include snippets/snakeoil.conf;"
Original file line number Diff line number Diff line change 3
3
- name : Distribute Mailman transport maps to backup MX servers
4
4
hosts : all
5
5
tasks :
6
- - name : Check postfix_lmtp
7
- stat :
6
+ - name : Check postfix_lmtp # noqa run-once
7
+ ansible.builtin. stat :
8
8
path : " {{ mailman3_core_var_dir }}/data/postfix_lmtp"
9
9
register : result
10
10
delegate_to : localhost
11
11
run_once : true
12
12
- name : Copy postfix_lmtp
13
- copy :
13
+ ansible.builtin. copy :
14
14
src : " {{ mailman3_core_var_dir }}/data/postfix_lmtp"
15
15
dest : " {{ mailman3_distribute_maps_dir }}/postfix_lmtp"
16
+ mode : ' 0644'
16
17
when : result.stat.exists
17
18
notify :
18
- - postmap
19
+ - Postmap
19
20
handlers :
20
- - name : postmap
21
- command : " {{ mailman3_postmap_command | default('postmap') }} {{ mailman3_distribute_maps_dir | quote }}/postfix_lmtp"
21
+ - name : Postmap
22
+ changed_when : false
23
+ ansible.builtin.command : " {{ mailman3_postmap_command | default('postmap') }} {{ mailman3_distribute_maps_dir | quote }}/postfix_lmtp"
Original file line number Diff line number Diff line change 6
6
7
7
# invoke systemctl directly until someone implements https://github.com/ansible/ansible/issues/61763
8
8
9
- - name : Restart mailman3-core service
9
+ - name : Restart mailman3-core service # noqa command-instead-of-module
10
10
ansible.builtin.command : systemctl try-restart {{ mailman3_core_service_name }}.service
11
- args :
12
- # can't noqa a multi-line yaml string and noqa command-instead-of-module makes the line fail the line length rule
13
- warn : false
11
+ changed_when : false
14
12
when :
15
13
- mailman3_process_manager == "systemd"
16
14
- ansible_virtualization_type != "docker"
17
15
18
- - name : Restart mailman3-web service
16
+ - name : Restart mailman3-web service # noqa command-instead-of-module
19
17
ansible.builtin.command : systemctl try-restart {{ mailman3_web_service_name }}{{ '@' if mailman3_domains is defined else '' }}{{ item }}.service
20
- args :
21
- warn : false
22
18
loop : " {{ mailman3_domains | default(['']) }}"
19
+ changed_when : false
23
20
when :
24
21
- mailman3_process_manager == "systemd"
25
22
- ansible_virtualization_type != "docker"
26
23
27
- - name : Reload mailman3-web service
24
+ - name : Reload mailman3-web service # noqa command-instead-of-module
28
25
ansible.builtin.command : systemctl try-reload-or-restart {{ mailman3_web_service_name }}{{ '@' if mailman3_domains is defined else '' }}{{ item }}.service
29
- args :
30
- warn : false
31
26
loop : " {{ mailman3_domains | default(['']) }}"
27
+ changed_when : false
32
28
when :
33
29
- mailman3_process_manager == "systemd"
34
30
- ansible_virtualization_type != "docker"
31
+
32
+ - name : Restart nginx
33
+ ansible.builtin.service :
34
+ name : nginx
35
+ state : restarted
Original file line number Diff line number Diff line change 14
14
ansible.builtin.copy :
15
15
content : |
16
16
[general]
17
- base_url: http://localhost/ {{ mailman3_hyperkitty_root | default('hyperkitty /') }}
17
+ base_url: {{ mailman3_hyperkitty_server_url }}/ {{ mailman3_hyperkitty_root | default('archives /') }}
18
18
api_key: {{ mailman3_archiver_key }}
19
19
dest : " {{ mailman3_core_etc_dir }}/hyperkitty.cfg"
20
20
group : " {{ __mailman3_core_group_name }}"
42
42
when : mailman3_wsgi_socket.startswith("/")
43
43
notify :
44
44
- Reload mailman3-web service
45
+
46
+ - name : Install digest cron task
47
+ ansible.builtin.cron :
48
+ name : " mailman digests"
49
+ special_time : daily
50
+ job : " {{ mailman3_install_dir}}/bin/mailman digests --periodic"
51
+ user : " {{ __mailman3_core_user_name }}"
52
+
53
+ - name : Install notify cron task
54
+ ansible.builtin.cron :
55
+ name : " mailman notify"
56
+ special_time : daily
57
+ job : " {{ mailman3_install_dir}}/bin/mailman notify"
58
+ user : " {{ __mailman3_core_user_name }}"
Original file line number Diff line number Diff line change 41
41
become_user : " {{ __mailman3_web_user_name }}"
42
42
43
43
- name : Create Django superusers
44
- community.general.django_manage : # noqa no-handler
44
+ community.general.django_manage : # noqa no-handler
45
45
command : >-
46
46
shell -c 'import sys;
47
47
from django.contrib.auth.models import User;
75
75
become_user : " {{ __mailman3_web_user_name }}"
76
76
77
77
- name : Correct default Django site
78
- community.general.django_manage : # noqa no-handler
78
+ community.general.django_manage : # noqa no-handler
79
79
command : >-
80
80
shell -c 'from django.contrib.sites.models import Site;
81
81
Site.objects.filter(domain="example.com").update(
Original file line number Diff line number Diff line change 30
30
- name : Include Django management tasks
31
31
ansible.builtin.import_tasks : django.yml
32
32
33
+ - name : Include Nginx tasks
34
+ ansible.builtin.import_tasks : nginx.yml
35
+ when : mailman3_install_nginx
36
+
33
37
- name : Include Postfix map distribution tasks
34
38
ansible.builtin.include_tasks : distribute_maps.yml
35
39
when : mailman3_distribute_maps is defined
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Install Nginx packages
4
+ ansible.builtin.package :
5
+ name : " nginx"
6
+ state : present
7
+
8
+ - name : Create letsencrypt renewal dir
9
+ ansible.builtin.file :
10
+ dest : " /var/www/letsencrypt"
11
+ state : directory
12
+ mode : ' 0755'
13
+
14
+ - name : Copy nginx vhost
15
+ ansible.builtin.template :
16
+ src : templates/vhost.j2
17
+ dest : /etc/nginx/sites-available/mailman-web
18
+ mode : ' 0644'
19
+ notify : Restart nginx
20
+
21
+ - name : Create link to the new config to enable it
22
+ ansible.builtin.file :
23
+ dest : /etc/nginx/sites-enabled/mailman-web
24
+ src : /etc/nginx/sites-available/mailman-web
25
+ state : link
26
+ notify : Restart nginx
27
+
28
+ - name : Remove default nginx vhost
29
+ ansible.builtin.file :
30
+ dest : /etc/nginx/sites-enabled/default
31
+ state : absent
32
+ notify : Restart nginx
Original file line number Diff line number Diff line change @@ -23,14 +23,14 @@ from django.urls import path, reverse_lazy
23
23
from django.views.generic import RedirectView
24
24
25
25
urlpatterns = [
26
- {% if mailman 3_postorius_root | default ('postorius /' ) %}
26
+ {% if mailman 3_postorius_root | default ('mailman3 /' ) %}
27
27
path(
28
28
'',
29
29
RedirectView.as_view(url=reverse_lazy('list_index'), permanent=True),
30
30
),
31
31
{% endif %}
32
- path(r'{{ mailman3_postorius_root | default("postorius /") }}', include('postorius.urls')),
33
- path(r'{{ mailman3_hyperkitty_root | default("hyperkitty /") }}', include('hyperkitty.urls')),
32
+ path(r'{{ mailman3_postorius_root | default("mailman3 /") }}', include('postorius.urls')),
33
+ path(r'{{ mailman3_hyperkitty_root | default("archives /") }}', include('hyperkitty.urls')),
34
34
path('', include('django_mailman3.urls')),
35
35
path('accounts/', include('allauth.urls')),
36
36
path('admin/', admin.site.urls),
Original file line number Diff line number Diff line change
1
+
2
+ upstream myapp {
3
+ server unix:/run/mailman3-web.sock;
4
+ }
5
+
6
+ server {
7
+ listen 80 default_server;
8
+ server_name {{ mailman3_web_url }};
9
+ #return 301 https://cpp.al$request_uri;
10
+ location '/.well-known/acme-challenge' {
11
+ default_type "text/plain";
12
+ root /var/www/letsencrypt;
13
+ }
14
+ location / {
15
+ return 301 https://$host$request_uri;
16
+ }
17
+ }
18
+
19
+ server {
20
+ listen 443 ssl default_server;
21
+ listen [::]:443 ssl default_server;
22
+ server_name {{ mailman3_web_url }};
23
+ location /static/ {
24
+ alias /var/lib/mailman3/web/static/;
25
+ }
26
+ location / {
27
+ proxy_pass http://myapp;
28
+ proxy_set_header Host $host;
29
+ proxy_set_header X-Forwarded-For $remote_addr;
30
+ }
31
+
32
+ {{ mailman3_nginx_ssl_certs }}
33
+ ssl_session_cache shared:le_nginx_SSL:10m;
34
+ ssl_session_timeout 1440m;
35
+ ssl_session_tickets off;
36
+ ssl_protocols TLSv1.2 TLSv1.3;
37
+ ssl_prefer_server_ciphers off;
38
+ ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
39
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
40
+ }
41
+
You can’t perform that action at this time.
0 commit comments