Defined Type: unbound::view

Defined in:
manifests/view.pp

Overview

Define a view in Unbound.

Examples:

Create a view

class { '::unbound':
  access_control_view => [
    ['192.0.2.0/24', 'test'],
  ],
}

::unbound::view { 'test':
  local_zone => [
    ['example.com.', 'typetransparent'],
  ],
  local_data => [
    {
      'name' => 'www.example.com.',
      'type' => 'A',
      'ip'   => '192.0.2.1',
    },
  ],
}

Parameters:

  • view (String) (defaults to: $title)
  • local_data (Optional[Array[Unbound::Record, 1]]) (defaults to: undef)
  • local_data_ptr (Optional[Array[Unbound::Record::PTR, 1]]) (defaults to: undef)
  • local_zone (Optional[Array[Tuple[Bodgitlib::Zone::NonRoot, Unbound::Type], 1]]) (defaults to: undef)
  • view_first (Optional[Boolean]) (defaults to: undef)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'manifests/view.pp', line 32

define unbound::view (
  String                                                             $view           = $title,
  Optional[Array[Unbound::Record, 1]]                                $local_data     = undef,
  Optional[Array[Unbound::Record::PTR, 1]]                           $local_data_ptr = undef,
  Optional[Array[Tuple[Bodgitlib::Zone::NonRoot, Unbound::Type], 1]] $local_zone     = undef,
  Optional[Boolean]                                                  $view_first     = undef,
) {

  if ! defined(Class['::unbound']) {
    fail('You must include the unbound base class before using any unbound defined resources')
  }

  $_local_data = $local_data ? {
    undef   => undef,
    default => $local_data.map |$x| {
      unbound::flatten_record($x)
    }
  }

  ::concat::fragment { "unbound view ${view}":
    content => template("${module_name}/view.erb"),
    order   => "30-${view}",
    target  => "${::unbound::conf_dir}/unbound.conf",
  }
}