Puppet Class: resolvconf

Defined in:
modules/resolvconf/manifests/init.pp

Summary

simple class to configure resolv.conf

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • nameservers (Array[Stdlib::Host,1])

    a list of nameserveres to configre

  • domain_search (Array[Stdlib::Fqdn]) (defaults to: [$facts['networking']['domain']])

    a list of domains to add to the domain search list

  • timeout (Integer[1,30]) (defaults to: 1)

    the timeout option

  • attempts (Integer[1,5]) (defaults to: 3)

    the attempts option

  • ndots (Integer[1,15]) (defaults to: 1)

    the ndots option

  • disable_resolvconf (Boolean) (defaults to: false)

    stop resolvconf from messing with our resolv.conf

  • disable_dhcpupdates (Boolean) (defaults to: false)

    stop dhcpd from messing with our resolv.conf

  • manage_resolv_conf (Boolean) (defaults to: true)

    if false dont try to manage resolv_conf, usefull for docker runs



11
12
13
14
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
52
53
54
55
56
57
# File 'modules/resolvconf/manifests/init.pp', line 11

class resolvconf (
    Array[Stdlib::Host,1] $nameservers,
    Array[Stdlib::Fqdn]   $domain_search       = [$facts['networking']['domain']],
    Integer[1,30]         $timeout             = 1,
    Integer[1,5]          $attempts            = 3,
    Integer[1,15]         $ndots               = 1,
    Boolean               $disable_resolvconf  = false,
    Boolean               $disable_dhcpupdates = false,
    Boolean               $manage_resolv_conf  = true,
) {
    $_nameservers = $nameservers.map |$nameserver| {
        if $nameserver =~ Stdlib::IP::Address {
            $nameserver
        } else {
            $nameserver.ipresolve(4)
        }
    }
    if $disable_resolvconf {
        file { '/sbin/resolvconf':
            owner  => 'root',
            group  => 'root',
            mode   => '0555',
            source => 'puppet:///modules/resolvconf/resolvconf.dummy',
        }
    }
    if $disable_dhcpupdates {
        file { '/etc/dhcp/dhclient-enter-hooks.d':
            ensure => 'directory',
        }

        file { '/etc/dhcp/dhclient-enter-hooks.d/nodnsupdate':
            owner  => 'root',
            group  => 'root',
            mode   => '0555',
            source => 'puppet:///modules/resolvconf/nodnsupdate',
        }
    }

    if $manage_resolv_conf {
        file { '/etc/resolv.conf':
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => template('resolvconf/resolv.conf.erb'),
        }
    }
}