Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/enableit/common/data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,6 @@ common::network::tcpshaker::concurrency: 50

## Vrrp
common::network::vrrp::enable: false

## DHCPD
common::network::dhcpd::manage: false
67 changes: 67 additions & 0 deletions modules/enableit/common/data/iclab.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
common::network::dhcpd::manage: true
common::network::dhcpd::interfaces:
- 'enp2s0'
common::network::dhcpd::dnsdomain:
- 'example.com'
common::network::dhcpd::nameservers:
- '192.168.69.1'
common::network::dhcpd::dnssearchdomains:
- 'example.com'
common::network::dhcpd::authoritative: true
common::network::dhcpd::default_lease_time: 43200
common::network::dhcpd::max_lease_time: 86400

common::network::dhcpd::pools:
'192.168.69.0':
network: '192.168.69.0'
mask: '255.255.255.0'
range:
- '192.168.69.2 192.168.69.255'
gateway: '192.168.1.254'
domain_name: 'example.com'
nameservers:
- '192.168.69.1'
options:
- 'time-offset -18000'

common::network::dhcpd::hosts:
'Cyberlink':
mac: 'dc:a6:32:32:03:66'
ip: '192.168.69.14'
'Promira':
mac: '90:8c:09:01:3f:dc'
ip: '192.168.69.17'
'PSU1':
mac: '80:09:02:1d:81:b6'
ip: '192.168.69.10'
'PSU2':
mac: '80:09:02:1d:a1:2f'
ip: '192.168.69.8'
'AWG':
mac: '80:09:02:0e:ef:bc'
ip: '192.168.69.13'
'DMM':
mac: '80:09:02:18:96:55'
ip: '192.168.69.11'
'SMU0':
mac: '08:00:11:26:6b:3c'
ip: '192.168.69.7'
'SMU1':
mac: '08:00:11:26:6b:31'
ip: '192.168.69.6'
'SMU2':
mac: '08:00:11:26:6b:36'
ip: '192.168.69.5'
'MSO':
mac: '80:09:02:15:03:70'
ip: '192.168.69.3'
'DSO':
mac: '00:30:64:50:ea:1a'
ip: '192.168.69.205'
'UPV':
mac: '00:e0:33:00:bf:6c'
ip: '192.168.69.124'
'CHAMBER':
mac: '00:0c:d8:0d:1c:0f'
ip: '192.168.69.57'
3 changes: 3 additions & 0 deletions modules/enableit/common/hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ hierarchy:
- name: "Subscription"
path: "subscriptions/%{::subscription}.yaml"

- name: "ICLAB"
path: "iclab.yaml"

- name: "common"
path: "common.yaml"
lookup_key: eyaml_lookup_key
Expand Down
4 changes: 4 additions & 0 deletions modules/enableit/common/manifests/network.pp
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,8 @@
if lookup('common::network::tcpshaker::enable', Boolean, undef, false) {
'common::network::tcpshaker'.contain
}

if lookup('common::network::dhcpd::manage', Boolean, undef, false) {
'common::network::dhcpd'.contain
}
}
66 changes: 66 additions & 0 deletions modules/enableit/common/manifests/network/dhcpd.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# @summary Class for managing DHCP server configuration
#
# @param manage Whether to manage the DHCP server. Defaults to false.
#
# @param enable Whether to enable the DHCP service. Defaults to true.
#
# @param interfaces Array of network interfaces to listen on. Required when manage is true.
#
# @param dnsdomain DNS domain name(s) for the DHCP scope. Defaults to undef (uses fact).
#
# @param nameservers Array of IPv4 DNS servers to hand out. Defaults to empty array.
#
# @param dnssearchdomains Array of DNS search domains. Defaults to empty array.
#
# @param authoritative Whether this server is authoritative. Defaults to true.
#
# @param default_lease_time Default lease time in seconds. Defaults to 43200.
#
# @param max_lease_time Maximum lease time in seconds. Defaults to 86400.
#
# @param pools Hash of DHCP pool configurations. Defaults to empty hash.
#
# @param hosts Hash of static DHCP host reservations. Defaults to empty hash.
#
# @param ignoredsubnets Optional hash of ignored subnet configurations. Defaults to undef.
#
# @groups service_control manage, enable.
#
# @groups network interfaces, dnsdomain, nameservers, dnssearchdomains.
#
# @groups lease authoritative, default_lease_time, max_lease_time.
#
# @groups pools pools, hosts, ignoredsubnets.
#
class common::network::dhcpd (
Boolean $manage = false,
Boolean $enable = true,
Optional[Array[String[1]]] $interfaces = undef,
Optional[Array[String[1]]] $dnsdomain = undef,
Array[Stdlib::IP::Address::V4] $nameservers = [],
Array[String[1]] $dnssearchdomains = [],
Boolean $authoritative = true,
Integer[-1] $default_lease_time = 43200,
Integer[-1] $max_lease_time = 86400,
Eit_types::Network::Dhcp::Pool $pools = {},
Eit_types::Network::Dhcp::Host $hosts = {},
Optional[Eit_types::Network::Dhcp::Ignoredsubnet] $ignoredsubnets = undef,
) {
if $manage {
$_service_ensure = $enable ? { true => 'running', default => 'stopped' }

class { '::dhcp':
interfaces => $interfaces,
dnsdomain => $dnsdomain,
nameservers => $nameservers,
dnssearchdomains => $dnssearchdomains,
authoritative => $authoritative,
default_lease_time => $default_lease_time,
max_lease_time => $max_lease_time,
pools => $pools,
hosts => $hosts,
ignoredsubnets => $ignoredsubnets ? { undef => {}, default => $ignoredsubnets },
service_ensure => $_service_ensure,
}
}
}
17 changes: 17 additions & 0 deletions modules/enableit/eit_types/types/network/dhcp/host.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# DHCP host reservation configuration
type Eit_types::Network::Dhcp::Host = Hash[String, Struct[{
'mac' => Eit_types::MAC,
'ip' => Optional[Stdlib::IP::Address],
'ddns_hostname' => Optional[String[1]],
'options' => Optional[Hash],
'comment' => Optional[String[1]],
'ignored' => Optional[Boolean],
'default_lease_time' => Optional[Integer],
'max_lease_time' => Optional[Integer],
'ipxe_filename' => Optional[String[1]],
'ipxe_bootstrap' => Optional[String[1]],
'filename' => Optional[String[1]],
'on_commit' => Optional[Array[String[1]]],
'on_release' => Optional[Array[String[1]]],
'on_expiry' => Optional[Array[String[1]]],
}]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DHCP ignored subnet configuration
type Eit_types::Network::Dhcp::Ignoredsubnet = Hash[String, Struct[{
'network' => String[1],
'mask' => String[1],
}]]
21 changes: 21 additions & 0 deletions modules/enableit/eit_types/types/network/dhcp/pool.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# DHCP pool configuration
type Eit_types::Network::Dhcp::Pool = Hash[String, Struct[{
'network' => Stdlib::IP::Address::V4,
'mask' => Stdlib::IP::Address::V4,
'host_mask' => Optional[Stdlib::IP::Address::V4],
'gateway' => Optional[Stdlib::IP::Address::V4],
'range' => Optional[Variant[Array[String[1], 1], String[1]]],
'failover' => Optional[String[1]],
'options' => Optional[Variant[Array[String[1]], String[1]]],
'parameters' => Optional[Variant[Array[String[1]], String[1]]],
'sharednetwork' => Optional[String[1]],
'nameservers' => Optional[Array[String]],
'nameservers_ipv6' => Optional[Array[String]],
'pxeserver' => Optional[String],
'mtu' => Optional[Integer],
'domain_name' => Optional[String[1]],
'ignore_unknown' => Optional[Boolean],
'on_commit' => Optional[Array[String[1]]],
'on_release' => Optional[Array[String[1]]],
'on_expiry' => Optional[Array[String[1]]],
}]]
Loading