Skip to content

Commit

Permalink
fix bertvv#179: guess the zone type also for reverse zones only
Browse files Browse the repository at this point in the history
  • Loading branch information
lisuml committed Nov 18, 2021
1 parent bc9e234 commit 2cb1ff2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions templates/etc_named.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@ zone "{{ bind_zone.name }}" IN {
{% endif %}
{% if bind_zone.networks is defined %}
{% if bind_zone.create_reverse_zones is not defined or bind_zone.create_reverse_zones %}
{# Start: set zone type #}
{% set _all_addresses = ansible_all_ipv4_addresses | union(ansible_all_ipv6_addresses) %}
{% if bind_zone.type is defined and bind_zone.type == 'primary' %}
{% set _type = 'primary' %}
{% elif bind_zone.type is defined and bind_zone.type == 'secondary' %}
{% set _type = 'secondary' %}
{% elif bind_zone.type is defined and bind_zone.type == 'forward' %}
{% set _type = 'forward' %}
{% elif bind_zone.type is not defined and bind_zone.primaries is defined and (_all_addresses|intersect(bind_zone.primaries)|length > 0) %}
{% set _type = 'primary' %}
{% elif bind_zone.type is not defined and bind_zone.primaries is defined and not (_all_addresses|intersect(bind_zone.primaries)|length > 0) %}
{% set _type = 'secondary' %}
{% elif bind_zone.type is not defined and bind_zone.forwarders is defined %}
{% set _type = 'forward' %}
{% endif %}
{# End: set zone type #}
{% for network in bind_zone.networks %}

zone "{{ ('.'.join(network.replace(network+'.','').split('.')[::-1])) }}.in-addr.arpa" IN {
Expand Down

0 comments on commit 2cb1ff2

Please sign in to comment.