aboutsummaryrefslogtreecommitdiff
path: root/manifests/hosts.pp
blob: fd99600b1f54064ce861c12c4fd16e640bb0d3f1 (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
# = Definition: dhcp::hosts
#
# Creates a dhcp configuration for given hosts
#
# Arguments
# $template:  dhcp host template - default: 'dhcp/host.conf.erb'
# $subnet:    targeted subnet
# $hash_data: hash containing data - default form:
#      {
#        <host1>         => {
#          options       => false,
#          fixed_address => false,
#          interfaces    => {
#            eth0        => 'mac-address',
#            eth1        => 'mac-address',
#            wlan0       => 'mac-address',
#            wlan1       => 'mac-address',
#            …,
#          }
#        },
#        <host2>         => {
#          options       => false,
#          fixed_address => false,
#          interfaces    => {
#            eth0        => 'mac-address',
#            eth1        => 'mac-address',
#            wlan0       => 'mac-address',
#            wlan1       => 'mac-address',
#            …,
#          }
#        },
#        …,
#      }
#
define dhcp::hosts (
  $hash_data,
  $subnet,
  $template = 'dhcp/host.conf.erb',
) {

  include dhcp::params

  concat::fragment {"dhcp.host.${name}":
    target  => "${dhcp::params::config_dir}/hosts.d/${subnet}.conf",
    content => template($template),
    notify  => Service['dhcpd'],
  }
}