diff options
-rw-r--r-- | host_vars/vultr | 25 | ||||
-rw-r--r-- | roles/mail/templates/postfix/virtual-users.j2 | 4 | ||||
-rw-r--r-- | roles/mail/templates/postfix/virtual.j2 | 18 |
3 files changed, 34 insertions, 13 deletions
diff --git a/host_vars/vultr b/host_vars/vultr index f60d2a7..f6220ef 100644 --- a/host_vars/vultr +++ b/host_vars/vultr @@ -58,6 +58,31 @@ mail: domains: - liwt.net # primary - aaronly.me + # user database, for both Postfix (receiving mails and transport to + # Dovecot) and Dovecot (auth users and deliver mails to disk) + userdb: + - name: root + aliases: + - postmaster + - hostmaster + - webmaster + - abuse + - name: aly + # for app/device-specific passwords + devices: + - laptop + - office + - phone + - tablet + - name: lulu + - name: wt + aliases: + - weitian + devices: + - laptop + - office + - phone + - tablet # Virtual user for local mail delivery (e.g., by Dovecot) vuser: name: vmail # user & group name 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 %} |