ansible-role-docker_mailserver/templates/docker-compose.yml
2024-01-14 12:36:32 +01:00

51 lines
2.2 KiB
YAML

# {{ ansible_managed }}
version: '3.3'
services:
mailserver:
image: mailserver/docker-mailserver:{{ docker_mailserver_version }}
ports:
{% if docker_mailserver_listen_ipv4 is not defined and docker_mailserver_listen_ipv6 is not defined %}
- 25:25 # SMTP (explicit TLS => STARTTLS)
- 465:465 # ESMTP (implicit TLS)
- 587:587 # ESMTP (explicit TLS => STARTTLS)
- 993:993 # IMAP4 (implicit TLS)
- 4190:4190 # Sieve
{% endif %}
{% if docker_mailserver_listen_ipv4 is defined %}
- "{{ docker_mailserver_listen_ipv4 }}:25:25" # SMTP (explicit TLS => STARTTLS)
- "{{ docker_mailserver_listen_ipv4 }}:465:465" # ESMTP (implicit TLS)
- "{{ docker_mailserver_listen_ipv4 }}:587:587" # ESMTP (explicit TLS => STARTTLS)
- "{{ docker_mailserver_listen_ipv4 }}:993:993" # IMAP4 (implicit TLS)
- "{{ docker_mailserver_listen_ipv4 }}:4190:4190" # Sieve
{% endif %}
{% if docker_mailserver_listen_ipv6 is defined %}
- "[{{ docker_mailserver_listen_ipv6 }}]:25:25" # SMTP (explicit TLS => STARTTLS)
- "[{{ docker_mailserver_listen_ipv6 }}]:465:465" # ESMTP (implicit TLS)
- "[{{ docker_mailserver_listen_ipv6 }}]:587:587" # ESMTP (explicit TLS => STARTTLS)
- "[{{ docker_mailserver_listen_ipv6 }}]:993:993" # IMAP4 (implicit TLS)
- "[{{ docker_mailserver_listen_ipv6 }}]:4190:4190" # Sieve
{% endif %}
volumes:
- {{ docker_mailserver_data_dir }}/{{ docker_mailserver_service_id }}/maildata:/var/mail
- {{ docker_mailserver_data_dir }}/{{ docker_mailserver_service_id }}/mailstate:/var/mail-state
- {{ docker_mailserver_data_dir }}/{{ docker_mailserver_service_id }}/maillogs:/var/log/mail
- ./config/:/tmp/docker-mailserver/
- ./policyd-spf.conf:/etc/postfix-policyd-spf-python/policyd-spf.conf
- ./jail.local:/etc/fail2ban/jail.local
- ./ssl/:/tmp/ssl:ro
- ./11-mail-custom.conf:/etc/dovecot/conf.d/11-mail-custom.conf
- ./dovecot-oauth2.conf.ext.secrets:/etc/dovecot/dovecot-oauth2.conf.ext
- /etc/localtime:/etc/localtime:ro
env_file:
- mailserver.vars
cap_add:
- NET_ADMIN
- SYS_PTRACE
restart: always
networks:
- default
networks:
default:
internal: false