aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mail
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-03-06 12:07:38 +0800
committerAaron LI <aly@aaronly.me>2018-03-14 11:35:08 +0800
commitf1ef586370fda462cb2022f401b2fb7f7e88232e (patch)
tree6dc37f1923c11c60c41b59de4a455a995ffd04e3 /roles/mail
parent028b2969000e4e83d21c1f75f6c29eb209c39532 (diff)
downloadansible-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.j24
-rw-r--r--roles/mail/templates/postfix/virtual.j218
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 %}