feat: Add BIND 9.20 forwarders configuration support

- Update forwarders template with enhanced functionality
- Add molecule test cases for forwarders validation
- Update options and zone templates for compatibility
This commit is contained in:
Daniel Akulenok
2026-01-23 12:24:06 +01:00
parent 29a30e9edd
commit 32a3de5bab
6 changed files with 91 additions and 11 deletions

View File

@@ -42,6 +42,46 @@
{% endif %}
{% endmacro %}
{% macro list_address_port_tls(dict, indent=bind9_config_indent) %}
{# This macro is for use for statements with grammar like #}
{# address port 00 tls string; address port 00 tls string; #}
{# it is usually called by a parent macro #}
{% filter indent(indent, true) %}
{% for item in dict %}
{% if item is not mapping %}
{{ item }};
{% elif item.address is string %}
{{ item.address -}}
{{- (' port ' + item.port | string) if item.port is defined and item.port -}}
{{- (' tls ' + item.tls | string) if item.tls is defined and item.tls -}};
{% elif item.address is sequence %}
{% for address in item.address %}
{{ address -}}
{{- (' port ' + item.port | string) if item.port is defined and item.port -}}
{{- (' tls ' + item.tls | string) if item.tls is defined and item.tls -}};
{% endfor %}
{% endif %}
{% endfor %}
{% endfilter %}
{% endmacro %}
{% macro parent_address_port_tls(name, dict) %}
{# This macro is for statements with grammar like #}
{# statement port 00 tls string { address port 00 tls string; address port 00 tls string; } #}
{# the list inside the statement is handled by list_address_port_tls #}
{% if dict is not mapping and dict is iterable %}
{{ name }} {
{{ list_address_port_tls(dict) -}}
};
{% else %}
{{ name }}
{{- (' port ' + dict.port | string) if dict.port is defined and dict.port -}}
{{- (' tls ' + dict.tls | string) if dict.tls is defined and dict.tls }} {
{{ list_address_port_tls(dict.addresses) -}}
};
{% endif %}
{% endmacro %}
{% macro list_address_port_dscp(dict, indent=bind9_config_indent) %}
{# This macro is for use for statements with grammar like #}
{# address port 00 dscp 00; address port 00 dscp 00; #}
@@ -65,12 +105,14 @@
{# the list inside the statement is handled by list_address_port #}
{% if dict is not mapping and dict is iterable %}
{{ name }} {
{{ list_address_port_dscp(dict) }}};
{{ list_address_port_dscp(dict) }}
};
{% else %}
{{ name }}
{{- (' port ' + dict.port | string) if dict.port is defined and dict.port -}}
{{- (' dscp ' + dict.dscp | string) if dict.dscp is defined and dict.dscp }} {
{{ list_address_port_dscp(dict.addresses) }}};
{{ list_address_port_dscp(dict.addresses) }}
};
{% endif %}
{% endmacro %}