Defined Type: nsd::zone

Defined in:
manifests/zone.pp

Overview

Define: nsd::zone

Parameters:

  • template (String)
  • vars (Hash) (defaults to: {})
  • templatestorage (Any) (defaults to: 'puppet')


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'manifests/zone.pp', line 3

define nsd::zone (
  String $template,
  Hash $vars       = {},
  $templatestorage = 'puppet',
) {
  include nsd

  $config_file = $nsd::config_file
  $owner       = $nsd::owner
  $zonedir     = $nsd::zonedir
  $zonefile    = "${name}.zone"

  concat::fragment { "nsd-zone-${name}":
    order   => '05',
    target  => $config_file,
    content => template('nsd/zone.erb'),
  }

  case $templatestorage {
    'puppet': {
      file { "${zonedir}/${zonefile}":
        owner   => $owner,
        group   => '0',
        mode    => '0640',
        content => template($template),
        notify  => Exec["nsd-control reload ${name}"],
      }
    }
    'hiera': {
      file { "${zonedir}/${zonefile}":
        owner   => $owner,
        group   => '0',
        mode    => '0640',
        content => hiera($template),
        notify  => Exec["nsd-control reload ${name}"],
      }
    }
    default: { fail('templatestorage must be either \'puppet\' or \'hiera\'') }
  }

  exec { "nsd-control reload ${name}":
    command     => "nsd-control reload ${name}",
    refreshonly => true,
    require     => [Concat[$config_file], Service[$nsd::service_name],],
  }
}