Puppet Class: base::resolving

Defined in:
modules/base/manifests/resolving.pp

Overview

Parameters:

  • domain_search (Any) (defaults to: $::domain)
  • labs_additional_domains (Any) (defaults to: [])
  • nameservers (Any) (defaults to: $::nameservers)


1
2
3
4
5
6
7
8
9
10
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
# File 'modules/base/manifests/resolving.pp', line 1

class base::resolving (
    $domain_search = $::domain,
    $labs_additional_domains = [],
    $nameservers = $::nameservers,
){
    if ! $nameservers {
        fail('Variable $nameservers is not defined!')
    }

    if $::realm == 'labs' {
        $labs_tld = hiera('labs_tld')
        $labs_site = lookup('labs_site', {'default_value' => $::site})
        # Thanks to dhcp, resolvconf is constantly messing with our resolv.conf.  Disable it.
        file { '/sbin/resolvconf':
            owner  => 'root',
            group  => 'root',
            mode   => '0555',
            source => 'puppet:///modules/base/resolv/resolvconf.dummy',
        }

        file { '/etc/dhcp/dhclient-enter-hooks.d':
            ensure => 'directory',
        }

        # also stop dhclient from updating resolv.conf.
        file { '/etc/dhcp/dhclient-enter-hooks.d/nodnsupdate':
            owner   => 'root',
            group   => 'root',
            mode    => '0555',
            source  => 'puppet:///modules/base/resolv/nodnsupdate',
            require => File['/etc/dhcp/dhclient-enter-hooks.d'],
        }

        # Now, finally, we can just puppetize the damn file
        file { '/etc/resolv.conf':
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => template('base/resolv.conf.labs.erb'),
        }
    } else {
        file { '/etc/resolv.conf':
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => template('base/resolv.conf.erb'),
        }
    }
}