forked from data.coop/ansible
145 lines
3.9 KiB
YAML
145 lines
3.9 KiB
YAML
---
|
|
|
|
- name: create mailu volume folders
|
|
file:
|
|
name: "{{ mailu.volume_folder }}/{{ volume }}"
|
|
state: directory
|
|
loop:
|
|
- redis
|
|
- certs
|
|
- overrides
|
|
- data
|
|
- dkim
|
|
- mail
|
|
- filter
|
|
- dav
|
|
- webmail
|
|
loop_control:
|
|
loop_var: volume
|
|
|
|
- name: upload mailu.env file
|
|
template:
|
|
src: mailu.env.j2
|
|
dest: "{{ mailu.volume_folder}}/mailu.env"
|
|
|
|
- name: run mail server containers
|
|
docker_service:
|
|
project_name: mail_server
|
|
pull: yes
|
|
definition:
|
|
version: '3.6'
|
|
services:
|
|
redis:
|
|
image: redis:alpine
|
|
restart: always
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/redis:/data"
|
|
|
|
postgresql:
|
|
image: mailu/postgresql:{{ mailu.version }}
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/data/psql_db:/data"
|
|
- "{{ mailu.volume_folder }}/data/psql_backup:/backup"
|
|
networks:
|
|
- name: mailu
|
|
|
|
front:
|
|
image: mailu/nginx:{{ mailu.version }}
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
environment:
|
|
VIRTUAL_HOST: "{{ mailu.domain }}"
|
|
LETSENCRYPT_HOST: "{{ mailu.domain }}"
|
|
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/certs:/certs"
|
|
- "{{ mailu.volume_folder }}/overrides/nginx:/overrides"
|
|
expose:
|
|
- "80"
|
|
ports:
|
|
- "993:993"
|
|
- "25:25"
|
|
- "587:587"
|
|
networks:
|
|
- default
|
|
- external_services
|
|
|
|
resolver:
|
|
image: mailu/unbound:{{ mailu.version }}
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
networks:
|
|
default:
|
|
ipv4_address: "{{ mailu.dns }}"
|
|
|
|
admin:
|
|
image: mailu/admin:{{ mailu.version }}
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/data:/data"
|
|
- "{{ mailu.volume_folder }}/dkim:/dkim"
|
|
depends_on:
|
|
- redis
|
|
|
|
imap:
|
|
image: mailu/dovecot:{{ mailu.version }}
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/mail:/mail"
|
|
- "{{ mailu.volume_folder }}/overrides:/overrides"
|
|
depends_on:
|
|
- front
|
|
|
|
smtp:
|
|
image: mailu/postfix:{{ mailu.version }}
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/overrides:/overrides"
|
|
depends_on:
|
|
- front
|
|
- resolver
|
|
dns:
|
|
- "{{ mailu.dns }}"
|
|
|
|
antispam:
|
|
image: mailu/rspamd:{{ mailu.version }}
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/filter:/var/lib/rspamd"
|
|
- "{{ mailu.volume_folder }}/dkim:/dkim"
|
|
- "{{ mailu.volume_folder }}/overrides/rspamd:/etc/rspamd/override.d"
|
|
depends_on:
|
|
- front
|
|
- resolver
|
|
dns:
|
|
- "{{ mailu.dns }}"
|
|
|
|
webmail:
|
|
image: mailu/rainloop:1.6
|
|
restart: always
|
|
env_file: "{{ mailu.volume_folder}}/mailu.env"
|
|
volumes:
|
|
- "{{ mailu.volume_folder }}/webmail:/data"
|
|
depends_on:
|
|
- front
|
|
- resolver
|
|
dns:
|
|
- "{{ mailu.dns }}"
|
|
|
|
networks:
|
|
default:
|
|
driver: bridge
|
|
ipam:
|
|
driver: default
|
|
config:
|
|
- subnet: "{{ mailu.subnet }}"
|
|
external_services:
|
|
external:
|
|
name: external_services
|