ansible-role-docker_mailserver/tasks/main.yml

85 lines
2.8 KiB
YAML

- name: docker directory
file:
path: /opt/{{ docker_mailserver_service_id }}/
state: directory
- name: config directory
file:
path: /opt/{{ docker_mailserver_service_id }}/{{ item }}
state: directory
with_items:
- config
- ssl
- name: prepare dovecot custom config
blockinfile:
dest: /opt/{{ docker_mailserver_service_id }}/11-mail-custom.conf
marker: "# {mark} ANSIBLE CONFIGURATION"
create: true
block: |
# System user and group used to access mails. If you use multiple, userdb
# can override these by returning uid or gid fields. You can use either numbers
# or names. <doc/wiki/UserIds.txt>
mail_uid = 5000
mail_gid = 5000
mail_home = /var/mail/%d/%n
# permet d'utiliser à la fois le + et le _ comme delimiteur dans les adresses email
# doit être paramétré de même dans postfix
recipient_delimiter = {{ docker_mailserver_recipient_delimiter }}
### section quotas ldap
mail_plugins = $mail_plugins quota
protocol imap {
# Enable the IMAP QUOTA extension, allowing IMAP clients to ask for the
# current quota usage.
mail_plugins = $mail_plugins imap_quota
}
plugin {
quota_grace = 10%%
# 10% is the default
quota_status_success = DUNNO
quota_status_nouser = DUNNO
quota_status_overquota = "552 5.2.2 Mailbox is full"
quota = count:User quota
quota_rule2 = Trash:storage=+100M
quota_vsizes = yes
quota_exceeded_message = La taille maximale de la boite de votre destinataire est atteinte.
quota_warning = storage=95%% quota-warning 95 %u libretic.fr
quota_warning2 = storage=80%% quota-warning 80 %u libretic.fr
quota_warning3 = -storage=100%% quota-warning below %u libretic.fr
}
service quota-warning {
executable = script /usr/local/bin/quota-warning
# user = root
unix_listener quota-warning {
mode = 0666
}
}
### debug
#auth_debug = yes
#mail_debug = yes
#auth_verbose = yes
- name: prepare docker-compose.yml and config
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { src: docker-compose.yml, dest: "/opt/{{ docker_mailserver_service_id }}/" }
- { src: policyd-spf.conf, dest: "/opt/{{ docker_mailserver_service_id }}/" }
- { src: jail.local, dest: "/opt/{{ docker_mailserver_service_id }}/" }
- { src: mailserver.vars, dest: "/opt/{{ docker_mailserver_service_id }}/" }
notify: docker-compose-up
- name: Prepare dovecot-oauth2.conf.ext.secrets
ansible.builtin.copy:
content: "{{ docker_mailserver_dovecot_oauth2_configuration }}"
dest: "/opt/{{ docker_mailserver_service_id }}/dovecot-oauth2.conf.ext.secrets"
notify: docker-compose-up
when: docker_mailserver_configure_oauth is true