diff options
author | Aaron LI <aly@aaronly.me> | 2018-03-06 12:07:38 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-03-14 11:35:08 +0800 |
commit | f1ef586370fda462cb2022f401b2fb7f7e88232e (patch) | |
tree | 6dc37f1923c11c60c41b59de4a455a995ffd04e3 /roles/mail | |
parent | 028b2969000e4e83d21c1f75f6c29eb209c39532 (diff) | |
download | ansible-dfly-vps-f1ef586370fda462cb2022f401b2fb7f7e88232e.tar.bz2 |
vars: add mail.userdb and use it in postfix virtual templates
Diffstat (limited to 'roles/mail')
-rw-r--r-- | roles/mail/templates/postfix/virtual-users.j2 | 4 | ||||
-rw-r--r-- | roles/mail/templates/postfix/virtual.j2 | 18 |
2 files changed, 9 insertions, 13 deletions
diff --git a/roles/mail/templates/postfix/virtual-users.j2 b/roles/mail/templates/postfix/virtual-users.j2 index 4de0a60..2408196 100644 --- a/roles/mail/templates/postfix/virtual-users.j2 +++ b/roles/mail/templates/postfix/virtual-users.j2 @@ -41,6 +41,6 @@ # Envelope sender | Owner (SASL login names) # --------------------------------------------------------------------- {% set mydomain = mail.domains[0] %} -{% for user in ["aly", "wt", "lulu", "root"] %} -{{ user }}@{{ mydomain }} {{ user }}@{{ mydomain }} +{% for user in mail.userdb %} +{{ user.name }}@{{ mydomain }} {{ user.name }}@{{ mydomain }} {% endfor %} diff --git a/roles/mail/templates/postfix/virtual.j2 b/roles/mail/templates/postfix/virtual.j2 index 191d38d..ea72b05 100644 --- a/roles/mail/templates/postfix/virtual.j2 +++ b/roles/mail/templates/postfix/virtual.j2 @@ -29,17 +29,13 @@ # --------------------------------------------------------------------- {% set mydomain = mail.domains[0] %} {% for domain in mail.domains %} -{% for user in ["aly", "wt", "lulu"] %} -{{ user }}@{{ domain }} {{ user }}@{{ mydomain }} +# [domain: {{ domain }}] +{% for user in mail.userdb %} +# (user: {{ user.name }}) +{{ user.name }}@{{ domain }} {{ user.name }}@{{ mydomain }} +# aliases (if any) +{% for alias in user.aliases|default([]) %} +{{ alias }}@{{ domain }} {{ user.name }}@{{ mydomain }} {% endfor %} {% endfor %} -# -{% for domain in mail.domains %} -weitian@{{ domain }} wt@{{ mydomain }} -{% endfor %} -# -{% for domain in mail.domains %} -{% for user in ["postmaster", "hostmaster", "webmaster", "root", "abuse"] %} -{{ user }}@{{ domain }} root@{{ mydomain }} -{% endfor %} {% endfor %} |