diff --git a/tasks/aliases.yml b/tasks/aliases.yml index f557e33..9dfa587 100644 --- a/tasks/aliases.yml +++ b/tasks/aliases.yml @@ -1,7 +1,7 @@ --- - name: "Aliases | Copy lookup tables from templates" ansible.builtin.template: - src: postfix/conf.d/virtual_aliases + src: postfix/conf.d/virtual_aliases.j2 dest: "{{ postfix_conf_dir }}/" mode: "0644" notify: reload postfix diff --git a/templates/postfix/conf.d/virtual_aliases.j2 b/templates/postfix/conf.d/virtual_aliases.j2 index 634ab53..207669b 100644 --- a/templates/postfix/conf.d/virtual_aliases.j2 +++ b/templates/postfix/conf.d/virtual_aliases.j2 @@ -1,25 +1,25 @@ # {{ ansible_managed }} -# Example variables list +# Example # # postfix_aliases: -# - domain: mydomain.org +# - domain: + name: mydomain.org # comment: | -# Mydomain.org -# List of Aliases +# # Mydomain.org +# # List of Aliases # aliases: # - name: foo # dest: # - "alice@yourdomain.org -# - "bob@yourdomain.org {% if postfix_aliases is defined %} {% for domain in postfix_aliases %} {% if domain.comment is defined %} -# {{ domain.comment }} +{{ domain.comment }} {% endif %} {% for alias in domain.aliases %} -{{ "%-50s %s" | format(alias.name, alias.dest | join(',')) }} +{{ "%-50s %s" | format(alias.name + '@' + domain.name, alias.dest | join(',')) }} {% endfor %} {% endfor %} {% endif %}