2022-12-28 15:38:33 +00:00
|
|
|
# vim: ft=yaml.ansible
|
2019-03-02 22:05:00 +00:00
|
|
|
---
|
|
|
|
- name: create mailu volume folders
|
|
|
|
file:
|
2022-11-26 08:15:18 +00:00
|
|
|
name: "{{ services.mailu.volume_folder }}/{{ volume }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
state: directory
|
|
|
|
loop:
|
|
|
|
- redis
|
|
|
|
- certs
|
|
|
|
- data
|
|
|
|
- dkim
|
|
|
|
- mail
|
2022-12-27 17:32:27 +00:00
|
|
|
- mailqueue
|
2019-03-02 22:05:00 +00:00
|
|
|
- filter
|
2022-12-26 19:37:49 +00:00
|
|
|
- postgres
|
2019-03-02 22:05:00 +00:00
|
|
|
- webmail
|
2022-12-26 19:37:49 +00:00
|
|
|
- overrides
|
|
|
|
- overrides/nginx
|
|
|
|
- overrides/dovecot
|
|
|
|
- overrides/postfix
|
|
|
|
- overrides/rspamd
|
|
|
|
- overrides/rainloop
|
2019-03-02 22:05:00 +00:00
|
|
|
loop_control:
|
|
|
|
loop_var: volume
|
|
|
|
|
|
|
|
- name: upload mailu.env file
|
|
|
|
template:
|
|
|
|
src: mailu.env.j2
|
2022-11-26 08:15:18 +00:00
|
|
|
dest: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 14:10:15 +00:00
|
|
|
- name: hard link to Let's Encrypt TLS certificate
|
|
|
|
file:
|
2022-11-26 08:15:18 +00:00
|
|
|
src: "{{ services.nginx_proxy.volume_folder }}/certs/{{ services.mailu.domain }}/fullchain.pem"
|
|
|
|
dest: "{{ services.mailu.volume_folder }}/certs/cert.pem"
|
2019-03-05 14:10:15 +00:00
|
|
|
state: hard
|
|
|
|
force: yes
|
2022-11-25 13:07:09 +00:00
|
|
|
when: letsencrypt_enabled
|
2019-03-05 14:10:15 +00:00
|
|
|
|
|
|
|
- name: hard link to Let's Encrypt TLS key
|
|
|
|
file:
|
2022-11-26 08:15:18 +00:00
|
|
|
src: "{{ services.nginx_proxy.volume_folder }}/certs/{{ services.mailu.domain }}/key.pem"
|
|
|
|
dest: "{{ services.mailu.volume_folder }}/certs/key.pem"
|
2019-03-05 14:10:15 +00:00
|
|
|
state: hard
|
|
|
|
force: yes
|
2022-11-25 13:07:09 +00:00
|
|
|
when: letsencrypt_enabled
|
2019-03-05 14:10:15 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
- name: run mail server containers
|
2021-02-01 20:06:23 +00:00
|
|
|
docker_compose:
|
2019-03-05 12:07:57 +00:00
|
|
|
project_name: mail_server
|
|
|
|
pull: yes
|
|
|
|
definition:
|
|
|
|
version: '3.6'
|
|
|
|
services:
|
2022-12-26 19:37:49 +00:00
|
|
|
postgres:
|
|
|
|
image: postgres:14-alpine
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-12-26 19:37:49 +00:00
|
|
|
environment:
|
|
|
|
POSTGRES_DB: mailu
|
|
|
|
POSTGRES_USER: mailu
|
|
|
|
POSTGRES_PASSWORD: "{{ postgres_passwords.mailu }}"
|
2019-03-05 12:07:57 +00:00
|
|
|
volumes:
|
2022-12-26 19:37:49 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/postgres:/var/lib/postgresql/data"
|
|
|
|
dns:
|
|
|
|
- "{{ services.mailu.dns }}"
|
2019-03-05 12:07:57 +00:00
|
|
|
|
2022-12-26 19:37:49 +00:00
|
|
|
redis:
|
|
|
|
image: redis:alpine
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
|
|
|
volumes:
|
2022-12-26 19:37:49 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/redis:/data"
|
|
|
|
depends_on:
|
|
|
|
- resolver
|
|
|
|
dns:
|
|
|
|
- "{{ services.mailu.dns }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
front:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: mailu/nginx:{{ services.mailu.version }}
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-05 12:07:57 +00:00
|
|
|
environment:
|
2022-11-26 08:15:18 +00:00
|
|
|
VIRTUAL_HOST: "{{ services.mailu.domain }}"
|
|
|
|
LETSENCRYPT_HOST: "{{ services.mailu.domain }}"
|
2019-03-05 12:07:57 +00:00
|
|
|
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
|
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/certs:/certs"
|
2022-12-26 19:37:49 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/overrides/nginx:/overrides:ro"
|
2019-03-05 12:07:57 +00:00
|
|
|
expose:
|
|
|
|
- "80"
|
|
|
|
ports:
|
|
|
|
- "993:993"
|
|
|
|
- "25:25"
|
|
|
|
- "587:587"
|
2019-11-19 10:10:05 +00:00
|
|
|
- "465:465"
|
2019-03-05 12:07:57 +00:00
|
|
|
networks:
|
|
|
|
- default
|
|
|
|
- external_services
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
resolver:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: mailu/unbound:{{ services.mailu.version }}
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-05 12:07:57 +00:00
|
|
|
networks:
|
|
|
|
default:
|
2022-11-26 08:15:18 +00:00
|
|
|
ipv4_address: "{{ services.mailu.dns }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
admin:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: mailu/admin:{{ services.mailu.version }}
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-05 12:07:57 +00:00
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/data:/data"
|
|
|
|
- "{{ services.mailu.volume_folder }}/dkim:/dkim"
|
2019-03-05 12:07:57 +00:00
|
|
|
depends_on:
|
|
|
|
- redis
|
2022-12-26 19:37:49 +00:00
|
|
|
- resolver
|
|
|
|
dns:
|
|
|
|
- "{{ services.mailu.dns }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
imap:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: mailu/dovecot:{{ services.mailu.version }}
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-05 12:07:57 +00:00
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/mail:/mail"
|
2022-12-26 19:37:49 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/overrides/dovecot:/overrides:ro"
|
2019-03-05 12:07:57 +00:00
|
|
|
depends_on:
|
|
|
|
- front
|
2022-12-26 19:37:49 +00:00
|
|
|
- resolver
|
|
|
|
dns:
|
|
|
|
- "{{ services.mailu.dns }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
smtp:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: mailu/postfix:{{ services.mailu.version }}
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-05 12:07:57 +00:00
|
|
|
volumes:
|
2022-12-26 19:37:49 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/mailqueue:/queue"
|
|
|
|
- "{{ services.mailu.volume_folder }}/overrides/postfix:/overrides:ro"
|
2019-03-05 12:07:57 +00:00
|
|
|
depends_on:
|
|
|
|
- front
|
|
|
|
- resolver
|
|
|
|
dns:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.dns }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
antispam:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: mailu/rspamd:{{ services.mailu.version }}
|
2022-12-26 19:37:49 +00:00
|
|
|
hostname: antispam
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-05 12:07:57 +00:00
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/filter:/var/lib/rspamd"
|
2022-12-26 19:37:49 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/overrides/rspamd:/etc/rspamd/override.d:ro"
|
2019-03-05 12:07:57 +00:00
|
|
|
depends_on:
|
|
|
|
- front
|
|
|
|
- resolver
|
|
|
|
dns:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.dns }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
webmail:
|
2022-12-26 19:37:49 +00:00
|
|
|
image: mailu/rainloop:{{ services.mailu.version }}
|
2019-03-05 12:07:57 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mailu.volume_folder}}/mailu.env"
|
2019-03-05 12:07:57 +00:00
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/webmail:/data"
|
2022-12-26 19:37:49 +00:00
|
|
|
- "{{ services.mailu.volume_folder }}/overrides/rainloop:/overrides:ro"
|
2019-03-05 12:07:57 +00:00
|
|
|
depends_on:
|
2022-12-26 19:37:49 +00:00
|
|
|
- imap
|
2019-03-05 12:07:57 +00:00
|
|
|
- resolver
|
|
|
|
dns:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mailu.dns }}"
|
2019-03-02 22:05:00 +00:00
|
|
|
|
2019-03-05 12:07:57 +00:00
|
|
|
networks:
|
|
|
|
default:
|
|
|
|
driver: bridge
|
|
|
|
ipam:
|
|
|
|
driver: default
|
|
|
|
config:
|
2022-11-26 08:15:18 +00:00
|
|
|
- subnet: "{{ services.mailu.subnet }}"
|
2019-03-05 12:07:57 +00:00
|
|
|
external_services:
|
|
|
|
external:
|
|
|
|
name: external_services
|