aboutsummaryrefslogtreecommitdiff
path: root/manifests/server/config.pp
blob: eb2efa12486147ecc08dfc0d4b0f10b2730ea8a7 (plain)
1
2
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
49
50
51
52
53
54
55
# Class: dhcp::server::config
#
# Configure the DHCP server
#
class dhcp::server::config {
  include ::dhcp::params

  validate_string($dhcp::params::config_dir)
  validate_absolute_path($dhcp::params::config_dir)
  validate_string($dhcp::params::server_template)
  validate_re($dhcp::params::server_template, '^\S+$')

  validate_string($dhcp::server::ddns_update)
  validate_bool($dhcp::server::authoritative)
  validate_array($dhcp::server::opts)

  $ddns_update = $dhcp::server::ddns_update
  $authoritative = $dhcp::server::authoritative
  $opts = $dhcp::server::opts
  $log_facility = $dhcp::server::log_facility

  concat {"${dhcp::params::config_dir}/dhcpd.conf":
    owner => root,
    group => root,
    mode  => '0644',
  }

  concat::fragment {'00.dhcp.server.base':
    ensure  => present,
    target  => "${dhcp::params::config_dir}/dhcpd.conf",
    content => template($dhcp::params::server_template),
  }

  file {"${dhcp::params::config_dir}/dhcpd.conf.d":
    ensure  => directory,
    mode    => '0700',
    recurse => true,
    purge   => true,
    force   => true,
  }

  file {"${dhcp::params::config_dir}/subnets":
    ensure  => directory,
    recurse => true,
    purge   => true,
    force   => true,
  }

  file {"${dhcp::params::config_dir}/hosts.d":
    ensure  => directory,
    recurse => true,
    purge   => true,
    force   => true,
  }
}