From 4a9a128ba9d3558839125fc66f0e080430806c78 Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Sat, 9 Jan 2016 08:12:21 +0000 Subject: [PATCH] add support for forward zones --- bind/files/arch/named.conf.local | 9 ++++++++- bind/files/debian/named.conf.local | 9 +++++++++ bind/files/redhat/named.conf.local | 9 ++++++++- pillar.example | 7 ++++++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/bind/files/arch/named.conf.local b/bind/files/arch/named.conf.local index edd6e33..e1b5703 100644 --- a/bind/files/arch/named.conf.local +++ b/bind/files/arch/named.conf.local @@ -11,6 +11,13 @@ {%- set masters = salt['pillar.get']("bind:available_zones:" + key + ":masters") %} zone "{{ key }}" { type {{ args['type'] }}; + {% if args['type'] == 'forward' -%} + forwarders { + {% for forwarder in args.forwarders -%} + {{ forwarder }}; + {% endfor -%} + }; + {% else -%} file "{{ file }}"; {% if args['type'] == "master" -%} {% if args['notify'] -%} @@ -22,6 +29,6 @@ zone "{{ key }}" { notify no; masters { {{ masters }} }; {%- endif %} + {%- endif %} }; {% endfor %} - diff --git a/bind/files/debian/named.conf.local b/bind/files/debian/named.conf.local index bdc3cee..0077de8 100644 --- a/bind/files/debian/named.conf.local +++ b/bind/files/debian/named.conf.local @@ -10,11 +10,19 @@ {%- macro zone(key, args, file, masters) %} zone "{{ key }}" { type {{ args['type'] }}; + {% if args['type'] == 'forward' -%} + forwarders { + {% for forwarder in args.forwarders -%} + {{ forwarder }}; + {% endfor -%} + }; + {% else -%} {% if args['dnssec'] is defined and args['dnssec'] -%} file "zones/{{ file }}.signed"; {% else -%} file "zones/{{ file }}"; {%- endif %} + {% if args['allow-update'] is defined -%} allow-update { {{args['allow-update']}}; }; {%- endif %} @@ -40,6 +48,7 @@ zone "{{ key }}" { notify no; masters { {{ masters }} }; {%- endif %} + {%- endif %} }; {%- endmacro %} diff --git a/bind/files/redhat/named.conf.local b/bind/files/redhat/named.conf.local index 03a053d..e193271 100644 --- a/bind/files/redhat/named.conf.local +++ b/bind/files/redhat/named.conf.local @@ -11,6 +11,13 @@ {%- set masters = salt['pillar.get']("bind:available_zones:" + key + ":masters") %} zone "{{ key }}" { type {{ args['type'] }}; + {% if args['type'] == 'forward' -%} + forwarders { + {% for forwarder in args.forwarders -%} + {{ forwarder }}; + {% endfor -%} + }; + {% else -%} file "data/{{ file }}"; {% if args['type'] == "master" -%} {% if args['notify'] -%} @@ -22,6 +29,6 @@ zone "{{ key }}" { notify no; masters { {{ masters }} }; {%- endif %} + {%- endif %} }; {% endfor %} - diff --git a/pillar.example b/pillar.example index a109d2a..948bece 100644 --- a/pillar.example +++ b/pillar.example @@ -33,7 +33,12 @@ bind: dynamic.domain.com: type: master allow-update: "key core_dhcp" - notify: True + notify: True + sub.anotherdomain.com: + type: forward + forwarders: + - 10.9.8.7 + - 10.9.8.5 configured_views: myview1: match_clients: