Puppet Class: install_server::dhcp_server

Defined in:
modules/install_server/manifests/dhcp_server.pp

Overview

Parameters:

  • ensure_service (Enum['stopped', 'running']) (defaults to: 'running')


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'modules/install_server/manifests/dhcp_server.pp', line 15

class install_server::dhcp_server (
    Enum['stopped', 'running'] $ensure_service = 'running',
){
    file { '/etc/dhcp':
        ensure  => directory,
        require => Package['isc-dhcp-server'],
        recurse => true,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        source  => 'puppet:///modules/install_server/dhcpd',
    }

    package { 'isc-dhcp-server':
        ensure => present,
    }

    service { 'isc-dhcp-server':
        ensure    => $ensure_service,
        require   => [
            Package['isc-dhcp-server'],
            File['/etc/dhcp']
        ],
        subscribe => File['/etc/dhcp'],
    }

    # TODO: Fold this into modules/install/dhcpd once
    # all jessie-based install servers are replaced.
    if os_version('debian >= buster') {
        file_line { 'dhcpd_interfaces':
          ensure => present,
          path   => '/etc/default/isc-dhcp-server',
          line   => "INTERFACESv4=\"${facts['interface_primary']}\"  # Managed by puppet",
          match  => "INTERFACESv4=\"\"",
        }
    }
}