Puppet Class: resolv_conf

Defined in:
manifests/init.pp

Overview

class: resolv_conf

Parameters

$nameserver IP address in dot notation of your name servers

$domain Local domain

$search Please refer to the resolv.conf(5) manual page

$sortlist (optional) Optional parameter that defaults to your netmask

$options (optional) Please refer to the resolv.conf(5) manual page

Authors

Thomas Linkin <tom@puppetlabs.com> Jon Mosco <jonny.mosco@gmail.com>

Parameters:

  • domain (Any) (defaults to: undef)
  • nameserver (Any) (defaults to: '127.0.0.1')
  • search (Any) (defaults to: undef)
  • sortlist (Any) (defaults to: [])
  • options (Any) (defaults to: undef)


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

class resolv_conf (
  $domain     = undef,
  $nameserver = '127.0.0.1',
  $search     = undef,
  $sortlist   = [],
  $options    = undef,
) {

  if is_string($nameserver) {
    $_nameserver = [$nameserver]
  } else {
    $_nameserver = $nameserver
  }

  validate_array($_nameserver)
  validate_string($domain)
  validate_slength($search, 256)
  validate_array($sortlist)

  if size($sortlist) > 10 {
    fail('sortlist can not contain more than 10 addresses')
  }

  file { 'resolv.conf':
    ensure  => file,
    path    => '/etc/resolv.conf',
    owner   => 0,
    group   => 0,
    mode    => '0644',
    content => template('resolv_conf/resolv.conf.erb'),
  }
}