# 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', Hash $dhcp4_conf = {}, Hash $dhcp6_conf = {}, Hash $ddns_conf = {}, Hash $ctrl_agent_conf = {}, Sensitive[String[1]] $api_password = '', ) { case $ensure { default: { $package_ensure = 'latest' $directory_ensure = 'directory' $link_ensure = 'link' $service_ensure = 'running' } /^(absent|delete|uninstall|remove|unregister)$/: { $package_ensure = 'absent' $directory_ensure = 'absent' $link_ensure = 'absent' $service_ensure = 'stopped' } } package { 'kea': ensure => $package_ensure, } file { '/etc/kea/kea-api-password': ensure => $ensure, 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'], } }