diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-05-26 16:18:30 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-05-26 16:18:30 -0300 |
commit | a2d2316176c496a11bb520ac6a88612756483395 (patch) | |
tree | 3112c30a1b7168ab8942b07de9631638623dd1dc /manifests | |
parent | 2f27ace0089a78e060ec1edf1ab58037344512ba (diff) | |
download | puppet-bind-a2d2316176c496a11bb520ac6a88612756483395.tar.gz puppet-bind-a2d2316176c496a11bb520ac6a88612756483395.tar.bz2 |
Adding bind::view
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/view.pp | 54 | ||||
-rw-r--r-- | manifests/zone.pp | 17 |
2 files changed, 67 insertions, 4 deletions
diff --git a/manifests/view.pp b/manifests/view.pp new file mode 100644 index 0000000..07f1b31 --- /dev/null +++ b/manifests/view.pp @@ -0,0 +1,54 @@ +# = Definition: bind::view +# +# Creates a valid Bind9 view. +# +# Arguments: +# *$match-clients*: Clients to be matched. +# *$recursion*: Whether it's a recursive view. +# +define bind::view ( + $ensure = present, + $match_clients = 'any', + $recursion = 'yes', +) { + + concat::fragment { "named.local.view.${name}": + ensure => $ensure, + target => '/etc/bind/named.conf.local', + content => "include \"/etc/bind/views/${name}.conf\";\n", + notify => Service['bind9'], + require => Package['bind9'], + } + + case $ensure { + present: { + concat { "/etc/bind/views/${name}.conf": + owner => root, + group => root, + mode => '0644', + } + + concat::fragment { "00.bind.views.${name}": + ensure => $ensure, + target => "/etc/bind/views/${name}.conf", + content => template('bind/view.erb'), + notify => Service['bind9'], + require => Package['bind9'], + } + + concat::fragment { "99.bind.views.${name}": + ensure => $ensure, + target => "/etc/bind/views/${name}.conf", + content => "};\n", + notify => Service['bind9'], + require => Package['bind9'], + } + } + absent: { + file {"/etc/bind/views/${name}.conf": + ensure => absent, + } + } + default: {} + } +} diff --git a/manifests/zone.pp b/manifests/zone.pp index 1b61788..db792ae 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -27,11 +27,20 @@ define bind::zone ( $zone_ns = false, $zone_xfers = false, $zone_masters = false, - $zone_origin = false + $zone_origin = false, + $view = false ) { + $target = $view ? { + false => "/etc/bind/zones/${name}.conf", + default => "/etc/bind/views/${view}.conf", + } + concat::fragment {"named.local.zone.${name}": - ensure => $ensure, + ensure => $view ? { + false => $ensure, + default => absent, + }, target => '/etc/bind/named.conf.local', content => "include \"/etc/bind/zones/${name}.conf\";\n", notify => Service['bind9'], @@ -40,14 +49,14 @@ define bind::zone ( case $ensure { present: { - concat {"/etc/bind/zones/${name}.conf": + concat { $target: owner => root, group => root, mode => '0644', } concat::fragment {"bind.zones.${name}": ensure => $ensure, - target => "/etc/bind/zones/${name}.conf", + target => $target, notify => Service['bind9'], require => Package['bind9'], } |