From 9f865f8cd33231c0dd7786faa2dec468e295f0fd Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 14 Jan 2017 19:33:20 +0100 Subject: Fix Ansible 2.2.0 compatibility of a Jinja2 template. --- roles/common/templates/etc/postfix/main.cf.j2 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'roles/common/templates') diff --git a/roles/common/templates/etc/postfix/main.cf.j2 b/roles/common/templates/etc/postfix/main.cf.j2 index 8caaa82..af909ba 100644 --- a/roles/common/templates/etc/postfix/main.cf.j2 +++ b/roles/common/templates/etc/postfix/main.cf.j2 @@ -36,17 +36,12 @@ relay_domains = smtp_tls_security_level = none smtpd_tls_security_level = none -{% set multi_instance = False %} -{%- for g in postfix_instance.keys() | sort -%} - {%- if g in group_names -%} - {%- if not multi_instance -%} - {%- set multi_instance = True -%} +{% set instances = postfix_instance.keys() | intersect(group_names) | list %} +{%- if instances | length > 0 -%} ## Other postfix instances multi_instance_wrapper = $command_directory/postmulti -p -- multi_instance_enable = yes -multi_instance_directories = - {%- endif %} /etc/postfix-{{ postfix_instance[g].name }} - {%- endif %} -{% endfor %} +multi_instance_directories ={% for i in instances | sort %} /etc/postfix-{{ postfix_instance[i].name }}{% endfor %} +{% endif %} # vim: set filetype=pfmain : -- cgit v1.2.3