This commit is contained in:
phil 2023-03-24 15:30:27 +01:00
parent bce2d91ea3
commit bc02212604
2 changed files with 8 additions and 8 deletions

View file

@ -1,7 +1,7 @@
--- ---
- name: "Aliases | Copy lookup tables from templates" - name: "Aliases | Copy lookup tables from templates"
ansible.builtin.template: ansible.builtin.template:
src: postfix/conf.d/virtual_aliases src: postfix/conf.d/virtual_aliases.j2
dest: "{{ postfix_conf_dir }}/" dest: "{{ postfix_conf_dir }}/"
mode: "0644" mode: "0644"
notify: reload postfix notify: reload postfix

View file

@ -1,25 +1,25 @@
# {{ ansible_managed }} # {{ ansible_managed }}
# Example variables list # Example
# #
# postfix_aliases: # postfix_aliases:
# - domain: mydomain.org # - domain:
name: mydomain.org
# comment: | # comment: |
# Mydomain.org # # Mydomain.org
# List of Aliases # # List of Aliases
# aliases: # aliases:
# - name: foo # - name: foo
# dest: # dest:
# - "alice@yourdomain.org # - "alice@yourdomain.org
# - "bob@yourdomain.org
{% if postfix_aliases is defined %} {% if postfix_aliases is defined %}
{% for domain in postfix_aliases %} {% for domain in postfix_aliases %}
{% if domain.comment is defined %} {% if domain.comment is defined %}
# {{ domain.comment }} {{ domain.comment }}
{% endif %} {% endif %}
{% for alias in domain.aliases %} {% 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 %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}