You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.8 KiB
48 lines
1.8 KiB
2 years ago
|
driver = pgsql
|
||
|
connect = host={{ hostvars[mail_server.db_server_hostname]['ansible_host'] }} user={{ mail_server.db_user }} password={{ mail_server.db_pass }} dbname={{ mail_server.db_name }}
|
||
|
default_pass_scheme = PLAIN
|
||
|
|
||
|
password_query = \
|
||
|
SELECT username AS user, \
|
||
|
( \
|
||
|
SELECT domain FROM mail_domains WHERE id = domain_id \
|
||
|
) AS domain, \
|
||
|
password_plaintext AS password, \
|
||
|
'{{ dovecot_mail_dir }}/%Ld/%Ln' AS userdb_home, \
|
||
|
concat('*:bytes=', coalesce(nullif(quota_mb, 0), {{ dovecot_max_quota_mb }}), 'M') AS userdb_quota_rule, \
|
||
|
{{ dovecot_dovemail_uid }} AS userdb_uid \
|
||
|
FROM mail_users \
|
||
|
WHERE \
|
||
|
LOWER(username) = '%Ln' AND \
|
||
|
domain_id = ( \
|
||
|
SELECT id FROM mail_domains WHERE LOWER(domain) = '%Ld' \
|
||
|
) AND \
|
||
|
enabled = true;
|
||
|
|
||
|
|
||
|
|
||
|
user_query = \
|
||
|
SELECT username AS user, \
|
||
|
( \
|
||
|
SELECT domain FROM mail_domains WHERE id = domain_id \
|
||
|
) AS domain, \
|
||
|
'{{ dovecot_mail_dir }}/%Ld/%Ln' AS home, \
|
||
|
concat('*:bytes=', coalesce(nullif(quota_mb, 0), {{ dovecot_max_quota_mb }}), 'M') AS quota_rule, \
|
||
|
{{ dovecot_dovemail_uid }} AS uid \
|
||
|
FROM mail_users \
|
||
|
WHERE \
|
||
|
LOWER(username) = '%Ln' AND \
|
||
|
domain_id = ( \
|
||
|
SELECT id FROM mail_domains WHERE LOWER(domain) = '%Ld' \
|
||
|
) AND \
|
||
|
enabled = true;
|
||
|
|
||
|
|
||
|
iterate_query = \
|
||
|
SELECT username AS user, \
|
||
|
( \
|
||
|
SELECT domain FROM mail_domains WHERE id = domain_id \
|
||
|
) AS domain \
|
||
|
FROM mail_users \
|
||
|
WHERE enabled = true;
|