diff options
author | Aaron LI <aly@aaronly.me> | 2018-03-06 15:59:39 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-03-14 11:35:08 +0800 |
commit | 35fba2ec5aa5a4f61ed4e8d805fab294549daa13 (patch) | |
tree | 9cf7d333ab0d57eac953aa6fe9f2c56f740bcb63 /roles/mail/templates/dovecot/passwd.j2 | |
parent | f1ef586370fda462cb2022f401b2fb7f7e88232e (diff) | |
download | ansible-dfly-vps-35fba2ec5aa5a4f61ed4e8d805fab294549daa13.tar.bz2 |
mail/dovecot: generate passwd from template
Diffstat (limited to 'roles/mail/templates/dovecot/passwd.j2')
-rw-r--r-- | roles/mail/templates/dovecot/passwd.j2 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/mail/templates/dovecot/passwd.j2 b/roles/mail/templates/dovecot/passwd.j2 new file mode 100644 index 0000000..b62ba2e --- /dev/null +++ b/roles/mail/templates/dovecot/passwd.j2 @@ -0,0 +1,31 @@ +# +# /usr/local/etc/dovecot/passwd +# Dovecot authentication database in passwd-file format. +# +# Format: +# user:password:uid:gid:(gecos):home:(shell):extra_fields +# +# Aaron LI +# + +{% set mydomain = mail.domains[0] %} +{% for domain in mail.domains %} +# [domain: {{ domain }}] +{% for user in mail.userdb %} +{% set name = user.name %} +# (user: {{ name }}) +{{ name }}@{{ domain }}:{{ passdb[name].pass }}::::::user={{ name }}@{{ mydomain }} +{% for dev in user.devices|default([]) %} +{{ name }}@{{ domain }}@{{ dev }}:{{ passdb[name].devices[dev] }}::::::user={{ name }}@{{ mydomain }} +{% endfor %}{# devices #} +{% if user.name != "root" and "aliases" in user %} +# aliases +{% for alias in user.aliases|default([]) %} +{{ alias }}@{{ domain }}:{{ passdb[name].pass }}::::::user={{ name }}@{{ mydomain }} +{% for dev in user.devices|default([]) %} +{{ alias }}@{{ domain }}@{{ dev }}:{{ passdb[name].devices[dev] }}::::::user={{ name }}@{{ mydomain }} +{% endfor %}{# devices #} +{% endfor %}{# alias #} +{% endif %}{# alias #} +{% endfor %}{# user #} +{% endfor %}{# domain #} |