From 82f4b63aa9821a9c27f81a916c8245bdfb4752a1 Mon Sep 17 00:00:00 2001 From: Rowcliffe Browne Date: Mon, 2 Nov 2015 09:40:51 +0800 Subject: [PATCH] - templatize default file - fix config.sls to match - add example to pillar.example --- bind/config.sls | 5 ++--- bind/files/debian/default | 12 ++++++++++++ bind/files/debian/default_ipv4 | 7 ------- bind/files/debian/default_ipv6 | 7 ------- bind/files/redhat/default | 9 +++++++++ bind/files/redhat/default_ipv4 | 4 ---- bind/files/redhat/default_ipv6 | 4 ---- pillar.example | 3 +++ 8 files changed, 26 insertions(+), 25 deletions(-) create mode 100644 bind/files/debian/default delete mode 100644 bind/files/debian/default_ipv4 delete mode 100644 bind/files/debian/default_ipv6 create mode 100644 bind/files/redhat/default delete mode 100644 bind/files/redhat/default_ipv4 delete mode 100644 bind/files/redhat/default_ipv6 diff --git a/bind/config.sls b/bind/config.sls index 214a9bd..2967331 100644 --- a/bind/config.sls +++ b/bind/config.sls @@ -67,17 +67,16 @@ bind_local_config: - watch_in: - service: bind -{% if salt['pillar.get']('bind:config:protocol', False) %} bind_default_config: file.managed: - name: {{ map.default_config }} - - source: salt://{{ map.config_source_dir }}/default_{{ salt['pillar.get']('bind:config:protocol', 'ipv4') }} + - source: salt://{{ map.config_source_dir }}/default + - template: jinja - user: root - group: root - mode: 644 - watch_in: - service: bind_restart -{% endif %} {% if grains['os_family'] == 'Debian' %} bind_key_config: diff --git a/bind/files/debian/default b/bind/files/debian/default new file mode 100644 index 0000000..f840308 --- /dev/null +++ b/bind/files/debian/default @@ -0,0 +1,12 @@ +{% set protocol = salt['pillar.get']('bind:config:protocol', False) -%} +{% set param = ['-u bind'] -%} +{% if protocol -%} + {%- param.append('-' + protocol|string) -%} +{% endif -%} +# run resolvconf? +RESOLVCONF=no + +# startup options for the server +# force ipv4 only +OPTIONS="{{ param|join(' ') }}" + diff --git a/bind/files/debian/default_ipv4 b/bind/files/debian/default_ipv4 deleted file mode 100644 index ab39cae..0000000 --- a/bind/files/debian/default_ipv4 +++ /dev/null @@ -1,7 +0,0 @@ -# run resolvconf? -RESOLVCONF=no - -# startup options for the server -# force ipv4 only -OPTIONS="-4 -u bind" - diff --git a/bind/files/debian/default_ipv6 b/bind/files/debian/default_ipv6 deleted file mode 100644 index 084b0ed..0000000 --- a/bind/files/debian/default_ipv6 +++ /dev/null @@ -1,7 +0,0 @@ -# run resolvconf? -RESOLVCONF=no - -# startup options for the server -# force ipv4 only -OPTIONS="-6 -u bind" - diff --git a/bind/files/redhat/default b/bind/files/redhat/default new file mode 100644 index 0000000..43f16e3 --- /dev/null +++ b/bind/files/redhat/default @@ -0,0 +1,9 @@ +{% set protocol = salt['pillar.get']('bind:config:protocol', False) -%} +{% set param = [] -%} +{% if protocol -%} + {%- param.append('-' + protocol|string) -%} +{% endif -%} +# ROOTDIR="/var/named/chroot" +# KEYTAB_FILE="/dir/file" +# DISABLE_ZONE_CHECKING +OPTIONS="{{ param|join(' ') }}" diff --git a/bind/files/redhat/default_ipv4 b/bind/files/redhat/default_ipv4 deleted file mode 100644 index 4d7e3a0..0000000 --- a/bind/files/redhat/default_ipv4 +++ /dev/null @@ -1,4 +0,0 @@ -# ROOTDIR="/var/named/chroot" -# KEYTAB_FILE="/dir/file" -# DISABLE_ZONE_CHECKING -OPTIONS="-4" diff --git a/bind/files/redhat/default_ipv6 b/bind/files/redhat/default_ipv6 deleted file mode 100644 index 6fd43cb..0000000 --- a/bind/files/redhat/default_ipv6 +++ /dev/null @@ -1,4 +0,0 @@ -# ROOTDIR="/var/named/chroot" -# KEYTAB_FILE="/dir/file" -# DISABLE_ZONE_CHECKING -OPTIONS="-6" diff --git a/pillar.example b/pillar.example index f877cd7..4b0e634 100644 --- a/pillar.example +++ b/pillar.example @@ -13,6 +13,9 @@ bind: options: allow-recursion: '{ any; };' # Never include this on a public resolver + # force bind to serve only one protocol. omitting this reverts to binds default of both. + protocol: 4 + bind: keys: "core_dhcp":