aboutsummaryrefslogtreecommitdiff
path: root/manifests/shared_network.pp
blob: 38f14fb7f6c9b302572a6d318af30536c9143559 (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
# == Definition: dhcp::shared-network
# Creates a shared-network
#
# Arguments:
#  *$subnets* : subnet list to be included in the shared-network
#
# Warnings:
#  - subnets must exists
#  - subnets must have $is_shared set to true (default is false)
#
define dhcp::shared_network(
  $ensure  = present,
  $subnets = [],
) {

  include ::dhcp::params

  validate_string($ensure)
  validate_re($ensure, ['present', 'absent'],
              "\$ensure must be either 'present' or 'absent', got '${ensure}'")
  validate_array($subnets)

  concat::fragment {"dhcp-shared-${name}":
    ensure  => $ensure,
    target  => "${dhcp::params::config_dir}/dhcpd.conf",
    content => template("${module_name}/shared-network.erb"),
    require => Dhcp::Subnet[$subnets],
  }

}