115 lines
3.8 KiB
YAML
115 lines
3.8 KiB
YAML
---
|
|
- name: Directorio de build dovecot
|
|
file:
|
|
path: /root/.dovecot-docker-image
|
|
state: directory
|
|
tags: skip_me
|
|
|
|
- name: Copiar archivos de build
|
|
copy:
|
|
src: "{{ item }}"
|
|
dest: /root/.dovecot-docker-image
|
|
loop:
|
|
- Dockerfile
|
|
- 10-mail.conf
|
|
- 10-master.conf
|
|
- 10-ssl.conf
|
|
- 15-mailboxes.conf
|
|
- 20-imap.conf
|
|
- 90-antispam.conf
|
|
- 90-sieve.conf
|
|
- junk-filter.sieve
|
|
- local.conf
|
|
- confd
|
|
tags: skip_me
|
|
|
|
- name: Crear imagen {{ dovecot_image }}
|
|
docker_image:
|
|
state: present
|
|
name: "{{ dovecot_image }}"
|
|
path: /root/.dovecot-docker-image
|
|
tags: skip_me
|
|
|
|
- name: Activar container dovecot
|
|
docker_container:
|
|
name: "{{ dovecot_container }}"
|
|
state: started
|
|
restart_policy: unless-stopped
|
|
image: "{{ dovecot_image }}"
|
|
volumes:
|
|
- "{{ dovecot_volume_config }}:/etc/dovecot/"
|
|
- "{{ dovecot_volume_mail }}:/vmail/"
|
|
- "{{ dovecot_volume_ssl }}:/ssl/"
|
|
networks:
|
|
- name: "{{ docker_network_name }}"
|
|
ports: >-
|
|
[ "143:143",
|
|
{{ '"587:587",' if dovecot_submission_enable else '' }}
|
|
"2000:2000"
|
|
]
|
|
|
|
env:
|
|
MAIL_DOMAINS: "{{ mail_domains.keys() | list | join(' ') }}"
|
|
AUTH_MECHANISMS: "{{ dovecot_auth_mechanisms }}"
|
|
AUTH_USERNAME_FORMAT: "{{ dovecot_auth_username_format }}"
|
|
AUTH_MASTER_ENABLE: "{{ 'yes' if dovecot_auth_master_enable else '' }}"
|
|
SUBMISSION_RELAY_HOST: "{{ dovecot_submission_relay_host }}"
|
|
SUBMISSION_RELAY_PORT: "{{ dovecot_submission_relay_port | string }}"
|
|
SUBMISSION_RELAY_TRUSTED: "{{ 'yes' if dovecot_submission_relay_trusted else 'no' }}"
|
|
SUBMISSION_RELAY_SSL_VERIFY: "{{ 'yes' if dovecot_submission_relay_ssl_verify else 'no' }}"
|
|
# SUBMISSION_RELAY_USER:
|
|
# SUBMISSION_RELAY_MASTER_USER:
|
|
# SUBMISSION_RELAY_PASSWORD:
|
|
# SUBMISSION_RELAY_SSL: starttls
|
|
# SUBMISSION_RELAY_RAWLOG_DIR:
|
|
LDAP_ENABLE: "{{ 'yes' if dovecot_ldap_enable else '' }}"
|
|
LDAP_HOSTS: "{{ dovecot_ldap_hosts | join(' ') }}"
|
|
LDAP_URIS: "{{ dovecot_ldap_uris | join(' ') }}"
|
|
LDAP_BIND: "{{ 'yes' if dovecot_ldap_bind else 'no' }}"
|
|
LDAP_VERSION: "{{ dovecot_ldap_version | string }}"
|
|
LDAP_BASE: "{{ dovecot_ldap_base }}"
|
|
LDAP_SCOPE: "{{ dovecot_ldap_scope }}"
|
|
LDAP_USER_ATTRS: "{{ dovecot_ldap_user_attrs }}"
|
|
LDAP_USER_FILTER: "{{ dovecot_ldap_user_filter }}"
|
|
LDAP_PASS_ATTRS: "{{ dovecot_ldap_pass_attrs }}"
|
|
LDAP_PASS_FILTER: "{{ dovecot_ldap_pass_filter }}"
|
|
LDAP_ITERATE_ATTRS: "{{ dovecot_ldap_iterate_attrs }}"
|
|
LDAP_ITERATE_FILTER: "{{ dovecot_ldap_iterate_filter }}"
|
|
LDAP_DEFAULT_PASS_SCHEME: "{{ dovecot_ldap_default_pass_scheme }}"
|
|
register: container
|
|
|
|
- name: Leer info de volumen {{ dovecot_volume_config }}
|
|
docker_volume_info:
|
|
name: "{{ dovecot_volume_config }}"
|
|
register: res_cfg
|
|
|
|
- name: Leer info de volumen {{ dovecot_volume_mail }}
|
|
docker_volume_info:
|
|
name: "{{ dovecot_volume_mail }}"
|
|
register: res_mail
|
|
|
|
- name: Leer info de volumen {{ dovecot_volume_ssl }}
|
|
docker_volume_info:
|
|
name: "{{ dovecot_volume_ssl }}"
|
|
register: res_ssl
|
|
|
|
- name: Exportar informacion de volumen
|
|
set_fact:
|
|
dovecot_container: "{{ lookup('vars','dovecot_container') }}"
|
|
dovecot_volume_config: "{{ lookup('vars','dovecot_volume_config') }}"
|
|
dovecot_mountpoint_config: "{{ res_cfg.volume.Mountpoint }}"
|
|
dovecot_volume_mail: "{{ lookup('vars','dovecot_volume_mail') }}"
|
|
dovecot_mountpoint_mail: "{{ res_mail.volume.Mountpoint }}"
|
|
dovecot_volume_ssl: "{{ lookup('vars','dovecot_volume_ssl') }}"
|
|
dovecot_mountpoint_ssl: "{{ res_ssl.volume.Mountpoint }}"
|
|
|
|
# FIXME: configurar quota mediante confd
|
|
#
|
|
# - name: Configuración de Dovecot (1)
|
|
# template:
|
|
# dest: "{{ dovecot_mountpoint_config }}/conf.d/{{ item }}"
|
|
# src: "{{item}}.j2"
|
|
# loop:
|
|
# - 90-quota.conf
|
|
# notify: restart dovecot
|