changes to indentation

This commit is contained in:
Daniel Akulenok
2022-08-19 22:01:36 +02:00
parent f0cd205c20
commit 8e12a4388f
18 changed files with 30 additions and 29 deletions

View File

@@ -11,6 +11,7 @@ bind9_backup_dir: /data/backup/bind
bind9_backup_config: true
bind9_debug_config: false
bind9_config_indent: 4
bind9_group_config: []
bind9_leaf_config: []

View File

@@ -1,6 +1,6 @@
{% macro controls(controls) %}
controls {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for control in controls %}
{% if control.type == "inet" %}
{{ ('inet ' + control.address) -}}

View File

@@ -1,7 +1,7 @@
{% macro dlz(dlzs) %}
{% for dlz in dlzs if dlzs is iterable %}
dlz "{{ dlz.name }}" {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ ('database "' + simple_item_list(dlz.database) + '";') }}
{{ functions.boolean_option('search', dlz.search) }}
{% endfilter %}

View File

@@ -1,10 +1,10 @@
{% macro dnssec_policy(policies) %}
{% for policy in policies if policies is iterable %}
dnssec-policy "{{ policy.name }}" {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% if policy.keys is defined and policy.keys %}
keys {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for dnskey in policy.keylist if policy.keylist is iterable %}
{{ dnskey.role -}}
{{ (' key-directory') if dnskey.key_directory is defined and dnskey.key_directory -}}

View File

@@ -1,7 +1,7 @@
{% macro dyndb(dyndbs) %}
{% for dyndb in dyndbs if dyndbs is iterable %}
dyndb {{ dyndb.name }} "{{ dyndb.driver }}" {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ functions.simple_item_list(dyndb.parameters) -}}
{% endfilter %}};
{% endfor %}

View File

@@ -1,11 +1,11 @@
{% macro simple_item_list(item_list, indent=2) %}
{% macro simple_item_list(item_list, indent=bind9_config_indent) %}
{# This macro is for use in simple address lists #}
{% filter indent(indent, true) %}
{{ item_list | join(';\n') }};
{% endfilter %}
{% endmacro %}
{% macro list_address_port_key_tls(dict, indent=2) %}
{% macro list_address_port_key_tls(dict, indent=bind9_config_indent) %}
{% filter indent(indent, true) %}
{% for item in dict %}
{% if item is not mapping %}
@@ -35,7 +35,7 @@
{% endif %}
{% endmacro %}
{% macro list_address_port_dscp(dict, indent=2) %}
{% 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; #}
{# it is usually called by a parent macro #}

View File

@@ -3,7 +3,7 @@
{% if item.options is defined and item.options %}
{% from 'named.conf.options.j2' import options with context %}
options {
{% filter indent(2,true)%}
{% filter indent(bind9_config_indent,true)%}
{{ options(item.options) -}}
{% endfilter %}
};

View File

@@ -1,10 +1,10 @@
{% macro http(seq) %}
{% for http in seq if seq is iterable %}
http {{ http.name }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% if http.endpoints is defined and http.endpoints %}
endpoints {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for endpoint in http.endpoints %}
{{ '"' + endpoint + '";' }}
{% endfor %}

View File

@@ -1,7 +1,7 @@
{% macro keylist(keylists) %}
{% for keyname in keylists if keylists is iterable %}
key {{ keyname.name }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ ('algorithm ' + keyname.algorithm + ';\n') if keyname.algorithm is defined and keyname.algorithm -}}
{{ ('secret "' + keyname.secret + '";\n') if keyname.secret is defined and keyname.secret -}}
{% endfilter %}};

View File

@@ -1,13 +1,13 @@
{% macro logging(logging) %}
logging {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for category in logging.categories if logging.categories is defined and logging.categories %}
category {{ category.name }} {
{{ functions.simple_item_list(category.channels) }}};
{% endfor %}
{% for channel in logging.channels if logging.channels is defined and logging.channels %}
channel {{ channel.name }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% if channel.file is defined and channel.file %}
file "{{ channel.file.name }}"
{{- (' versions ' + channel.file.versions | string) if channel.file.versions is defined and channel.file.versions -}}

View File

@@ -2,7 +2,7 @@
{# Unicorn Options#}
{% if option.rrset_order is defined and option.rrset_order %}
rrset-order {
{% filter indent(4, true) %}
{% filter indent(bind9_config_indent*2, true) %}
{% for rrset in option.rrset_order %}
{{ ('class ' + rrset.class | string + ' ') if rrset.class is defined and rrset.class -}}
{{ ('type ' + rrset.type | string + ' ') if rrset.type is defined and rrset.type -}}
@@ -13,7 +13,7 @@ rrset-order {
{% endif %}
{% if option.response_policy is defined and option.response_policy %}
response-policy {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for zone in option.response_policy.zones %}
{{- ('zone ' + zone.zone | string) -}}
{{- (' max-policy-ttl ' + zone.max_policy_ttl | string) if zone.max_policy_ttl is defined and zone.max_policy_ttl -}}
@@ -47,7 +47,7 @@ response-padding {
{% endif %}
{% if option.rate_limit is defined and option.rate_limit %}
rate-limit {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ ('all-per-second ' + option.rate_limit.all_per_second | string + ';\n') if option.rate_limit.all_per_second is defined and option.rate_limit.all_per_second -}}
{{ ('errors-per-second ' + option.rate_limit.errors_per_second | string + ';\n') if option.rate_limit.errors_per_second is defined and option.rate_limit.errors_per_second -}}
{{ ('responses-per-second ' + option.rate_limit.responses_per_second | string + ';\n') if option.rate_limit.responses_per_second is defined and option.rate_limit.responses_per_second -}}
@@ -104,7 +104,7 @@ listen-on
dual-stack-servers
{{ (' port ' + option.dual_stack_servers.port | string) if option.dual_stack_servers.port is defined and option.dual_stack_servers }} {
{% for host in option.dual_stack_servers.addresses %}
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ host.address | ansible.utils.ipaddr | ternary(host.address, '"' + host.address + '"') }}
{{- (' port ' + host.port | string) if host.port is defined and host.port -}}
{{- (' dscp ' + host.dscp | string) if host.dscp is defined and host.dscp -}};
@@ -120,7 +120,7 @@ dnstap-output {{ option.dnstap_output.output_type -}}
{% endif %}
{% if option.dnstap is defined and option.dnstap %}
dnstap {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for dnstap in option.dnstap %}
{{ dnstap.type }}{{ ' ' + dnstap.log if dnstap.log is defined and dnstap.log }};
{% endfor %}
@@ -129,7 +129,7 @@ dnstap {
{% if option.dns64 is defined and option.dns64 %}
{% for dns64 in option.dns64 if option.dns64 is sequence %}
dns64 {{ dns64.netprefix }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ ('break-dnssec ' + dns64.break_dnssec | functions.named_boolean + ';\n') if dns64.break_dnssec is defined and dns64.break_dnssec is boolean -}}
{{ ('recursive-only ' + dns64.recursive_only | functions.named_boolean + ';\n') if dns64.recursive_only is defined and dns64.recursive_only is boolean -}}
{{ ('suffix ' + dns64.suffix + ';\n') if dns64.suffix is defined and dns64.suffix -}}
@@ -164,7 +164,7 @@ check-names {{ policy.type }} {{ policy.action }};
catalog-zones {
{% for catalog_zone in option.catalog_zones %}
zone {{ catalog_zone.zone }}
{% filter indent(6, true) %}
{% filter indent(bind9_config_indent*3, true) %}
{% if catalog_zone.default_primaries is defined and catalog_zone.default_primaries %}
default-primaries
{{- (' port ' + catalog_zone.default_primaries.port | string) if catalog_zone.default_primaries.port is defined and catalog_zone.default_primaries.port -}}

View File

@@ -3,7 +3,7 @@
parental-agents {{ agent.name -}}
{{ (' port ' + agent.port | string) if agent.port is defined and agent.port -}}
{{ (' dscp ' + agent.dscp | string) if agent.dscp is defined and agent.dscp }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ functions.list_address_port_key_tls(agent.addresses) -}}
{% endfilter %}};
{% endfor %}

View File

@@ -1,7 +1,7 @@
{% macro server(servers) %}
{% for server in servers if servers is iterable %}
server {{ server.prefix }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% if server.transfer_source is defined and server.transfer_source is mapping %}
transfer-source {{ server.transfer_source.address -}}
{{- (' port ' + server.transfer_source.port | string) if server.transfer_source.port is defined and server.transfer_source.port -}}

View File

@@ -1,6 +1,6 @@
{% macro statistics_channels(statistics_channels) %}
statistics-channels {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for channel in statistics_channels if statistics_channels is iterable %}
inet {{ channel.address | string }}
{{- (' port ' + channel.port | string) if channel.port is defined and channel.port -}}

View File

@@ -1,7 +1,7 @@
{% macro tls(tlss) %}
{% for tls in tlss if tlss is iterable %}
tls {{ tls.name }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ ('cert-file "' + tls.cert_file + '";\n') if tls.cert_file is defined and tls.cert_file -}}
{{ ('key-file "' + tls.key_file + '";\n') if tls.key_file is defined and tls.key_file -}}
{{ ('dhparam-file "' + tls.dhparam_file + '";\n') if tls.dhparam_file is defined and tls.dhparam_file -}}

View File

@@ -1,6 +1,6 @@
{% macro trust_anchors(trust_anchors) %}
trust-anchors {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for anchor in trust_anchors if trust_anchors is iterable %}
{{ (anchor.name | string) -}}
{{ (' ' + anchor.type) -}}

View File

@@ -1,7 +1,7 @@
{% macro view(views) %}
{% for view in views if views is iterable %}
view {{ view.name }} {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{{ ('match-recursive-only ' + functions.named_boolean(view.match_recursive_only) + ';\n') if view.match_recursive_only is defined -}}
{{ ('match-clients {\n' + functions.simple_item_list(view.match_clients) + '};\n') if view.match_clients is defined and view.match_clients -}}
{{ ('match-destinations {\n' + functions.simple_item_list(view.match_destinations) + '};\n') if view.match_destinations is defined and view.match_destinations -}}

View File

@@ -2,7 +2,7 @@
{% macro zones(zones) -%}
{% for zone in zones %}
zone "{{ zone.name }}" {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
# Zone {{ zone.name }} type {{ zone.type }}
{# Most critical/defining statements first #}
{{ ('type ' + zone.type | string+';\n') if zone.type is defined and zone.type -}}
@@ -24,7 +24,7 @@ zone "{{ zone.name }}" {
update-policy local;
{% else %}
update-policy {
{% filter indent(2, true) %}
{% filter indent(bind9_config_indent, true) %}
{% for policy in zone.update_policy %}
{{ policy.permission -}}
{{ ' ' + policy.identity -}}