Puppet Class: kea

Defined in:
manifests/init.pp

Summary

Main class for ISC Kea DHCP server management. Installs and configures ISC Kea from Cloudsmith repositories.

Overview

Examples:

Basic usage with DHCPv4 only

class { 'kea':
  dhcp4 => {
    enable => true,
  },
}

Full configuration via Hiera

kea::dhcp4:
  enable: true
  interfaces: ['eth0']
  subnets:
    - id: 1
      subnet: '192.168.1.0/24'
      pools:
        - pool: '192.168.1.100 - 192.168.1.200'

Parameters:

  • repo_version (String[1]) (defaults to: '3-0')

    The Kea repository version to use (e.g., ‘3-0’, ‘3-1’, ‘dev’). This module only supports Kea 3.0.x and newer versions. Defaults to ‘3-0’ (current LTS).

  • manage_repo (Boolean) (defaults to: true)

    Whether to manage the Cloudsmith apt repository.

  • dhcp4 (Optional[Hash]) (defaults to: undef)

    Hash of DHCPv4 server configuration options. Set to undef or empty hash to disable DHCPv4.

  • dhcp6 (Optional[Hash]) (defaults to: undef)

    Hash of DHCPv6 server configuration options. Set to undef or empty hash to disable DHCPv6.

  • ddns (Optional[Hash]) (defaults to: undef)

    Hash of DHCP-DDNS server configuration options. Set to undef or empty hash to disable DDNS.

  • hooks_package (Boolean) (defaults to: true)

    Whether to install the open source hooks package.

  • mysql_backend (Boolean) (defaults to: false)

    Whether to install MySQL backend support.

  • postgresql_backend (Boolean) (defaults to: false)

    Whether to install PostgreSQL backend support.

  • config_dir (Stdlib::Absolutepath) (defaults to: '/etc/kea')

    Base configuration directory for Kea.

  • run_dir (Stdlib::Absolutepath) (defaults to: '/var/run/kea')

    Runtime directory for PID files and sockets.

  • log_dir (Stdlib::Absolutepath) (defaults to: '/var/log/kea')

    Log directory for Kea services.

  • lib_dir (Stdlib::Absolutepath) (defaults to: '/var/lib/kea')

    Library directory for lease files and state.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'manifests/init.pp', line 63

class kea (
  # Repository settings
  String[1]           $repo_version        = '3-0',
  Boolean             $manage_repo         = true,

  # Component toggles - use hashes for grouped config
  Optional[Hash]      $dhcp4               = undef,
  Optional[Hash]      $dhcp6               = undef,
  Optional[Hash]      $ddns                = undef,

  # Package options
  Boolean             $hooks_package       = true,
  Boolean             $mysql_backend       = false,
  Boolean             $postgresql_backend  = false,

  # Directory configuration
  Stdlib::Absolutepath $config_dir         = '/etc/kea',
  Stdlib::Absolutepath $run_dir            = '/var/run/kea',
  Stdlib::Absolutepath $log_dir            = '/var/log/kea',
  Stdlib::Absolutepath $lib_dir            = '/var/lib/kea',
) {
  # Validate OS family
  unless $facts['os']['family'] == 'Debian' {
    fail("kea module only supports Debian-based systems. Detected: ${facts['os']['family']}")
  }

  # Repository management
  if $manage_repo {
    contain kea::repo
  }

  # Install common package (required by all components)
  contain kea::install

  # Ensure directories exist with Kea 3.0 required permissions
  file { $config_dir:
    ensure => directory,
    owner  => '_kea',
    group  => '_kea',
    mode   => '0750',
  }

  file { $run_dir:
    ensure => directory,
    owner  => '_kea',
    group  => '_kea',
    mode   => '0750',
  }

  file { $log_dir:
    ensure => directory,
    owner  => '_kea',
    group  => '_kea',
    mode   => '0750',
  }

  file { $lib_dir:
    ensure => directory,
    owner  => '_kea',
    group  => '_kea',
    mode   => '0750',
  }

  # Configure components based on provided hashes
  if $dhcp4 and $dhcp4['enable'] {
    contain kea::dhcp4
  }

  if $dhcp6 and $dhcp6['enable'] {
    contain kea::dhcp6
  }

  if $ddns and $ddns['enable'] {
    contain kea::ddns
  }

  # Establish ordering
  if $manage_repo {
    Class['kea::repo']
    -> Class['kea::install']
  }

  Class['kea::install']
  -> File[$config_dir]
  -> File[$run_dir]
  -> File[$log_dir]
  -> File[$lib_dir]
}