From 28310f7755c850364d6dac100c21d6fcd24b47b5 Mon Sep 17 00:00:00 2001 From: Daniel Akulenok Date: Mon, 3 Oct 2022 12:26:42 +0200 Subject: [PATCH] Extend function to also iterate over list of addresses with the same key --- templates/named.conf.functions.j2 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/named.conf.functions.j2 b/templates/named.conf.functions.j2 index 7b89025..0ba8399 100644 --- a/templates/named.conf.functions.j2 +++ b/templates/named.conf.functions.j2 @@ -10,11 +10,18 @@ {% for item in dict %} {% if item is not mapping %} {{ item -}}; -{% else %} +{% elif item.address is string %} {{ item.address -}} {{- (' port ' + item.port | string) if item.port is defined -}} {{- (' key ' + item.key | string) if item.key is defined -}} {{- (' tls ' + item.tls | string) if item.tls is defined -}}; +{% elif item.address is sequence %} +{% for address in item.address %} +{{ address -}} +{{- (' port ' + item.port | string) if item.port is defined -}} +{{- (' key ' + item.key | string) if item.key is defined -}} +{{- (' tls ' + item.tls | string) if item.tls is defined -}}; +{% endfor %} {% endif %} {% endfor %} {% endfilter %}