aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/resolver.pp
blob: 00fe6c63c26de7939ae814a9022216af828a8026 (plain)
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
class nodo::subsystem::resolver(
  $manage      = lookup('nodo::subsystem::resolver::manage', undef, undef,      false),
  $nameservers = lookup('nodo::subsystem::resolver::nameservers', undef, undef, ''),
  $domain      = lookup('nodo::subsystem::resolver::domain', undef, undef,      $::domain),
  $search      = lookup('nodo::subsystem::resolver::search', undef, undef,      $::fqdn)
) {
  # DNS resolver
  case $manage {
    'package': {
      package { 'resolvconf':
        ensure => present,
      }

      file { '/etc/resolv.conf':
        ensure  => '/etc/resolvconf/run/resolv.conf',
        require => Package['resolvconf'],
      }
    }
    'class': {
      class { 'resolvconf':
        domain      => $domain,
        search      => $search,
        nameservers => $nameservers,
      }
    }
    unmanage: {
      package { 'resolvconf':
        ensure => absent,
      }

      file { '/etc/resolv.conf':
        ensure => present,
        owner  => root,
        group  => root,
        mode   => '0644',
      }
    }
  }
}