From 0f5d3e601979d553bf2754dfb4effce05f34f917 Mon Sep 17 00:00:00 2001 From: Alex Frolkin Date: Fri, 11 Sep 2015 13:46:40 +0100 Subject: [PATCH] Add support for notify-source and also-notify Conflicts: templates/view.erb --- manifests/view.pp | 2 ++ manifests/zone.pp | 5 +++++ templates/view.erb | 11 ++++++++++- templates/zone.conf.erb | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/manifests/view.pp b/manifests/view.pp index 467fc88..ff128f3 100644 --- a/manifests/view.pp +++ b/manifests/view.pp @@ -9,6 +9,8 @@ define bind::view ( $recursion_match_clients = 'any', $recursion_match_destinations = '', $recursion_match_only = false, + $notify_source = '', + $also_notify = [], $order = '10', ) { $confdir = $::bind::confdir diff --git a/manifests/zone.pp b/manifests/zone.pp index 10b7cfb..62c985f 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -6,6 +6,7 @@ define bind::zone ( $dynamic = true, $masters = '', $transfer_source = '', + $notify_source = '', $allow_updates = '', $update_policies = '', $allow_transfers = '', @@ -48,6 +49,10 @@ define bind::zone ( fail("transfer_source may only be provided for bind::zone resources with zone_type 'slave' or 'stub'") } + unless !($notify_source != '' and ! member(['master', 'slave'], $zone_type)) { + fail("notify_source may only be provided for bind::zone resources with zone_type 'master' or 'slave'") + } + unless !($allow_updates != '' and ! $dynamic) { fail("allow_updates may only be provided for bind::zone resources with dynamic set to true") } diff --git a/templates/view.erb b/templates/view.erb index 9270391..8f7b802 100644 --- a/templates/view.erb +++ b/templates/view.erb @@ -42,7 +42,16 @@ view "<%= @name %>" { keys { <%= properties['keys'] %>; }; <%- end -%> }; -<%- end -%> +<%- end -%> +<%- if @also_notify and @also_notify != '' -%> + also-notify { +<%- Array(@also_notify).each do |server| -%> + <%= server %>; +<%- end -%> + }; +<%- end -%> +<%- if @notify_source and @notify_source != '' -%> + notify-source <%= @notify_source %>; <%- end -%> <%- if scope.lookupvar('osfamily') == 'Debian' -%> include "<%= @confdir %>/named.conf.default-zones"; diff --git a/templates/zone.conf.erb b/templates/zone.conf.erb index 6efcfce..d07dccb 100644 --- a/templates/zone.conf.erb +++ b/templates/zone.conf.erb @@ -40,6 +40,9 @@ zone "<%= @_domain %>" { <%- if @transfer_source and @transfer_source != ''-%> transfer-source <%= @transfer_source %>; <%- end -%> +<%- if @notify_source and @notify_source != ''-%> + notify-source <%= @notify_source %>; +<%- end -%> <%- if @allow_updates and @allow_updates != '' -%> allow-update { <%- Array(@allow_updates).each do |allow_update| -%>