Add dovecot-sql config

This commit is contained in:
Tunui Franken 2024-01-09 14:49:25 +01:00
parent 4b2aa0db8a
commit 17eebf1abf
2 changed files with 28 additions and 0 deletions

View file

@ -93,3 +93,12 @@
regexp: "{{ item.regexp }}" regexp: "{{ item.regexp }}"
line: "{{ item.line }}" line: "{{ item.line }}"
notify: Reload dovecot service notify: Reload dovecot service
- name: Copy dovecot-sql.conf.ext
become: true
ansible.builtin.template:
src: dovecot-sql.conf.ext.j2
dest: /etc/dovecot/dovecot-sql.conf.ext
owner: root
group: root
mode: "640"

View file

@ -0,0 +1,19 @@
# {{ ansible_managed }}
driver = pgsql
connect = \
host=127.0.0.1 \
dbname={{ mailserver_database_db }} \
user={{ mailserver_database_ro_user.name }} \
password={{ mailserver_database_ro_user.pwd }}
user_query = SELECT email as user, \
concat('*:bytes=', quota) AS quota_rule, \
'/var/vmail/%d/%n' AS home \
5000 AS uid, 5000 AS gid \
FROM virtual_users WHERE email='%u'
password_query = SELECT password FROM virtual_users WHERE email='%u'
iterate_query = SELECT email AS user FROM virtual_users