Defined Type: bind::zone::forward

Defined in:
manifests/zone/forward.pp

Summary

Manage a forward zone

Overview

Examples:

Using the defined type


bind::zone::forward { 'example.com':
  forwarders => [ '192.168.1.1', '192.168.1.2', ],
  forward    => 'only',
}

Parameters:

  • forwarders (Array[String]) (defaults to: [])

    An array of strings that define the forwarding servers for this zone. All queries for the zone will be forwarded to these servers.

  • forward (Optional[Bind::Forward]) (defaults to: undef)

    Only forward queries (value ‘only`) or try to resolve if forwarders do not answer the query (value `first`).

  • view (Optional[String]) (defaults to: undef)

    The name of the view that should include this zone. Must be set if views are used.

  • comment (Optional[String]) (defaults to: undef)

    A comment to add to the zone file.

  • zone (String) (defaults to: $name)

    The name of the zone.

  • class (Bind::Zone::Class) (defaults to: 'IN')

    The zone class.

  • order (String) (defaults to: '40')

    Zones are ordered by this parameter value in the zone file.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'manifests/zone/forward.pp', line 35

define bind::zone::forward (
  Array[String]           $forwarders = [],
  Optional[Bind::Forward] $forward    = undef,
  Optional[String]        $view       = undef,
  Optional[String]        $comment    = undef,
  String                  $zone       = $name,
  Bind::Zone::Class       $class      = 'IN',
  String                  $order      = '40',
) {
  # The base class must be included first
  unless defined(Class['bind']) {
    fail('You must include the bind base class before using any bind defined resources')
  }

  $params = {
    'zone'       => $zone,
    'forwarders' => $forwarders,
    'forward'    => $forward,
    'class'      => $class,
    'comment'    => $comment,
    'indent'     => bool2str($bind::views_enable, '  ', ''),
  }

  if $bind::views_enable {
    assert_type(String, $view) |$expected,$actual| {
      fail('The parameter view must be a String if views are enabled')
    }

    @concat::fragment { "named.conf.views-${view}-60-${zone}":
      target  => 'named.conf.views',
      content => epp("${module_name}/zone-forward.epp", $params),
      order   => $order,
      tag     => ["named.conf.views-${view}",],
    }
  }
  else {
    concat::fragment { "named.conf.zones-${zone}":
      target  => 'named.conf.zones',
      content => epp("${module_name}/zone-forward.epp", $params),
      order   => $order,
    }
  }
}