# = Definition: bind::view # # Creates a valid Bind9 view. # # Arguments: # *$match-clients*: Clients to be matched. # *$recursion*: Whether it's a recursive view. # *$order*: View order at named.conf.local. # define bind::view ( $ensure = present, $match_clients = 'any', $allow_query = false, $recursion = 'yes', $order = 10, ) { concat::fragment { "named.local.view.${name}": ensure => $ensure, target => '/etc/bind/named.conf.local', content => "include \"/etc/bind/views/${name}.conf\";\n", order => $order, 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", order => 99, notify => Service['bind9'], require => Package['bind9'], } } absent: { file {"/etc/bind/views/${name}.conf": ensure => absent, } } default: {} } }