Add configuration of kea

This commit is contained in:
Antonio J. Delgado 2023-11-13 09:30:11 +02:00
parent 420148167f
commit 3be54b15d4

View file

@ -1,14 +1,32 @@
# Class to install and configure ISC Kea DHCP service
# Class to install and configure ISC Kea DHCP service.
# Check https://kb.isc.org/docs/kea-configuration-sections-explained for details
# for each parameter.
#
# [*ensure*]
# present or absent. Default: present
#
# [*dhcp4_conf*]
# Hash with the DHCP 4 service configuration.
#
# [*dhcp6_conf*]
# Hash with the DHCP 4 service configuration.
#
# [*ddns_conf*]
# Hash with the Dynamic DNS configuration.
#
# [*ctrl_agent_conf*]
# Hash with the Control Agent configuration.
#
# [*api_password*]
# (Sensitive) String API password.
#
class kea (
String $ensure = 'present',
Sensitive[String[1]] $api_password,
Hash $dhcp4_conf = {},
Hash $dhcp6_conf = {},
Hash $ddns_conf = {},
Hash $ctrl_agent_conf = {},
Sensitive[String[1]] $api_password = '',
) {
case $ensure {
default: {
@ -27,11 +45,43 @@ class kea (
package { 'kea':
ensure => $package_ensure,
}
file_line { 'kea_api_password':
file { '/etc/kea/kea-api-password':
ensure => $ensure,
path => '/etc/kea/kea-api-password',
match => '.*',
line => $api_password,
content => $api_password,
mode => '0640',
require => Package['kea'],
notify => Service['kea'],
}
file { '/etc/kea/kea-dhcp4.conf':
ensure => $ensure,
content => to_json($dhcp4_conf),
mode => '0644',
require => Package['kea'],
notify => Service['kea'],
}
file { '/etc/kea/kea-dhcp6.conf':
ensure => $ensure,
content => to_json($dhcp6_conf),
mode => '0644',
require => Package['kea'],
notify => Service['kea'],
}
file { '/etc/kea/kea-dhcp-ddns.conf':
ensure => $ensure,
content => to_json($ddns_conf),
mode => '0644',
require => Package['kea'],
notify => Service['kea'],
}
file { '/etc/kea/kea-ctrl-agent.conf':
ensure => $ensure,
content => to_json($ctrl_agent_conf),
mode => '0644',
require => Package['kea'],
notify => Service['kea'],
}
service { 'kea':
ensure => $service_ensure,
require => Package['kea'],
}
}