From f0239ca59967dca7fbb1846c3d4d4425aa8e9999 Mon Sep 17 00:00:00 2001 From: Olivier Navas Date: Fri, 30 Aug 2024 12:24:33 +0200 Subject: [PATCH] variable docker_mailserver_configure_oauth --- defaults/main.yml | 6 ++++++ tasks/main.yml | 8 +++++++- templates/docker-compose.yml | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 47c168e..97dd7fb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -46,3 +46,9 @@ docker_mailserver_saslauthd_ldap_filter: "(&(uid=%U)(objectClass=PostfixBookMail docker_mailserver_default_relay_host: "" # Relai sortant par défaut (configuration par domaine) docker_mailserver_relay_host: "" + + +# Active la configuration oauth +# Nécessite de fournir des variables supplémentaires : +# - docker_mailserver_dovecot_oauth2_configuration +docker_mailserver_configure_oauth: false diff --git a/tasks/main.yml b/tasks/main.yml index ab393e6..2c7a41c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -76,4 +76,10 @@ - { 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 diff --git a/templates/docker-compose.yml b/templates/docker-compose.yml index 292da25..f20f3b7 100644 --- a/templates/docker-compose.yml +++ b/templates/docker-compose.yml @@ -35,7 +35,9 @@ services: - ./jail.local:/etc/fail2ban/jail.local - ./ssl/:/tmp/ssl:ro - ./11-mail-custom.conf:/etc/dovecot/conf.d/11-mail-custom.conf +{% if docker_mailserver_configure_oauth is true %} - ./dovecot-oauth2.conf.ext.secrets:/etc/dovecot/dovecot-oauth2.conf.ext +{% endif %} - /etc/localtime:/etc/localtime:ro env_file: - mailserver.vars