Puppet Class: resolvconf::config

Defined in:
manifests/config.pp

Overview

Class: resolvconf::config

Takes two types of configuration:

  • nameservers are appended to ‘resolv.conf.d/head` to ensure that they always come first.

  • domain, search, and options, are appended to ‘resolv.conf.d/tail` to ensure that they come last.

Using this rather brute force method, instead of ‘interfaces(5)`, because it requires no other parsing or knowledge about the network configuration.



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
# File 'manifests/config.pp', line 13

class resolvconf::config(
) {
  $use_local     = $::resolvconf::use_local
  $nameservers   = $::resolvconf::nameservers
  $domain        = $::resolvconf::domain
  $search        = $::resolvconf::search
  $options       = $::resolvconf::options
  $override_dhcp = $::resolvconf::override_dhcp

  if ($domain != '') and ($search != []) {
    fail('The domain and search params are mutually exclusive')
  }

  validate_bool($use_local, $override_dhcp)
  validate_array($nameservers, $search, $options)
  validate_string($domain)

  include resolvconf::dpkg_reconfigure

  $resolv_conf_target = $::lsbmajdistrelease ? {
    /^1[0-1]$/ => '/etc/resolvconf/run/resolv.conf',
    default     => '../run/resolvconf/resolv.conf',
  }

  file { '/etc/resolv.conf':
    ensure => link,
    target => $resolv_conf_target,
    notify => Class['resolvconf::dpkg_reconfigure'],
  }

  file { '/etc/resolvconf/resolv.conf.d/head':
    ensure  => file,
    content => template('resolvconf/etc/resolvconf/resolv.conf.d/head.erb'),
  }

  file { '/etc/resolvconf/resolv.conf.d/tail':
    ensure  => file,
    content => template('resolvconf/etc/resolvconf/resolv.conf.d/tail.erb'),
  }
}