Puppet Class: resolv_conf

Inherits:
resolv_conf::params
Defined in:
manifests/init.pp

Overview

Resolve_conf

Manage the /etc/resolv.conf file

Parameters:

  • search_keyword (String) (defaults to: $resolv_conf::params::search_keyword)

    Keyword prefix for search domains

  • search (String) (defaults to: $resolv_conf::params::search)

    Search domain

  • options (Array[String]) (defaults to: $resolv_conf::params::options)

    Array of options

  • nameservers (Array[String]) (defaults to: $resolv_conf::params::nameservers)

    Array of nameservers

  • resolv_conf_path (String) (defaults to: $resolv_conf::params::resolv_conf_path)

    Path to /etc/resolve.conf

  • resolv_conf_owner (String) (defaults to: $resolv_conf::params::resolv_conf_owner)

    Owner for /etc/resolve.conf

  • resolv_conf_group (String) (defaults to: $resolv_conf::params::resolv_conf_group)

    Group for /etc/resolve.conf

  • resolv_conf_mode (String) (defaults to: $resolv_conf::params::resolv_conf_mode)

    Mode for /etc/resolve.conf



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

class resolv_conf(
    String        $search_keyword    = $resolv_conf::params::search_keyword,
    String        $search            = $resolv_conf::params::search,
    Array[String] $options           = $resolv_conf::params::options,
    Array[String] $nameservers       = $resolv_conf::params::nameservers,
    String        $resolv_conf_path  = $resolv_conf::params::resolv_conf_path,
    String        $resolv_conf_owner = $resolv_conf::params::resolv_conf_owner,
    String        $resolv_conf_group = $resolv_conf::params::resolv_conf_group,
    String        $resolv_conf_mode  = $resolv_conf::params::resolv_conf_mode,
) inherits resolv_conf::params{


  $template_vars = {
    "search_keyword" => $search_keyword,
    "search"         => $search,
    "nameservers"    => $nameservers,
    "options"        => $options,
  }

  file { $resolv_conf_path:
    ensure  => file,
    owner   => $resolv_conf_owner,
    group   => $resolv_conf_group,
    mode    => $resolv_conf_mode,
    content => epp("${module_name}/resolv.conf.epp", $template_vars),
  }

  # On Solaris must also bounce the dns client service
  if $facts['os']['family'] == "Solaris" {
    Service { "dns/client":
      ensure    => running,
      enable    => true,
      subscribe => File[$resolv_conf_path],
    }
  }
}