aboutsummaryrefslogtreecommitdiff
path: root/manifests/server/config.pp
blob: 0c1a74a75cae9390499745d98a0b9d7345846c42 (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
# Class: dhcp::server::config
#
# Configure the DHCP server
#
class dhcp::server::config {
  include ::dhcp::params
  include ::concat::setup

  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)

  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,
    source  => "puppet:///modules/${module_name}/empty"
  }

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

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