From 0b859fd1a430de46305b53ddf1d30cc5f8618b89 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 7 Feb 2024 16:14:29 +0100 Subject: [PATCH] dovecot: add variables for LDAP --- CHANGELOG.md | 1 + dovecot/defaults/main.yml | 6 ++++++ dovecot/tasks/main.yml | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 952dd072..f4d899a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ The **patch** part changes is incremented if multiple releases happen the same m * apt: Disable archive repository for Debian 8 * apt: Use the GPG version of the key for Debian 8-9 * bind: Update role for Buster, Bullseye and Bookworm support +* dovecot: add variables for LDAP * dovecot: Munin plugin conf path is now `/etc/munin/plugin-conf.d/zzz-dovecot` (instead of `z-evolinux-dovecot`) * evocheck: upstream release 24.01 * evolinux-base: dump-server-state upstream release 23.11 diff --git a/dovecot/defaults/main.yml b/dovecot/defaults/main.yml index 77bbfa05..e190adb6 100644 --- a/dovecot/defaults/main.yml +++ b/dovecot/defaults/main.yml @@ -2,5 +2,11 @@ general_alert_email: "root@localhost" log2mail_alert_email: Null + dovecot_vmail_uid: 5000 dovecot_vmail_gid: 5000 + +ldap_hostname: "{{ ansible_hostname }}" +ldap_domain: "{{ ansible_domain }}" +ldap_suffix: "dc={{ ldap_hostname }},dc={{ ldap_domain.split('.')[-2] }},dc={{ ldap_domain.split('.')[-1] }}" +ldap_enabled: False diff --git a/dovecot/tasks/main.yml b/dovecot/tasks/main.yml index 3260e80e..8589a701 100644 --- a/dovecot/tasks/main.yml +++ b/dovecot/tasks/main.yml @@ -35,12 +35,12 @@ - { key: 'hosts', value: '127.0.0.1' } - { key: 'auth_bind', value: 'yes' } - { key: 'ldap_version', value: 3 } - - { key: 'base', value: "{{ ldap_suffix }}" } + - { key: 'base', value: "{{ ldap_suffix | mandatory }}" } - { key: 'user_attrs', value: 'homeDirectory=home' } - { key: 'user_filter', value: '(&(isActive=TRUE)(uid=%u))' } - { key: 'pass_attrs', value: 'uid=user,userPassword=password' } - { key: 'iterate_filter', value: '(&(isActive=TRUE))' } - when: ldap_suffix is defined + when: ldap_enabled | bool | default(False) notify: reload dovecot tags: - dovecot