Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple_bind - Support for secondary external zones #24

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions simple-bind/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ simple_bind__forward_zones:
# extra_conf:
# - 'foo: bar'

simple_bind__external_secondary_zones:
# - zone: example.com
# primaries: [192.168.1.1]
# extra_conf:
# - 'foo: bar'

simple_bind__install_ferm_svc: false
61 changes: 47 additions & 14 deletions simple-bind/templates/named.conf.local.j2
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
// {{ ansible_managed }}

acl internals {
localhost;
{{ internal_networks | ansible.utils.ipv4 }}
{{ internal_networks | ansible.utils.ipv6 }}
};

view internals {
match-clients { internals; };
allow-transfer { internals; };
allow-recursion { internals; };

{% for zone in simple_bind__forward_zones or [] -%}
zone "{{ zone.zone }}" {
type forward;
forward {{ zone.forward | default('first') }};
forwarders {
zone "{{ zone.zone }}" {
type forward;
forward {{ zone.forward | default('first') }};
forwarders {
{% for forwarder in zone.get('forwarders') or [] %}
{{ forwarder }};
{{ forwarder }};
{% endfor -%}
};
file "db.{{ zone.zone }}";
};
file "db.internal.{{ zone.zone }}";
{% for extra in zone.get('extra_conf') or [] %}
{{ extra }};
{{ extra }};
};
{% endfor %}
};

{% endfor -%}

{% for zone in simple_bind__secondary_zones or [] -%}
zone "{{ zone.zone }}" {
type slave;
masters {
zone "{{ zone.zone }}" {
type slave;
masters {
{% for primary in zone.get('primaries') or [] %}
{{ primary }};
{{ primary }};
{% endfor %}
};
file "db.{{ zone.zone }}";
file "db.internal.{{ zone.zone }}";
{% for extra in zone.get('extra_conf') or [] %}
{{ extra }};
{{ extra }};
{% endfor %}
};

{% endfor %}
};

view externals {
match-clients { any; };
allow-transfer {"none"; };
recursion no;

{% for zone in simple_bind__external_secondary_zones or [] -%}
zone "{{ zone.zone }}" {
type slave;
masters {
{% for primary in zone.get('primaries') or [] %}
{{ primary }};
{% endfor %}
};
file "db.external.{{ zone.zone }}";
{% for extra in zone.get('extra_conf') or [] %}
{{ extra }};
{% endfor %}
};
};