Puppet Class: dnsclient
- Defined in:
- manifests/init.pp
Summary
Manage DNS resolverOverview
This module manages /etc/resolv.conf
.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'manifests/init.pp', line 46
class dnsclient (
Array[Stdlib::IP::Address] $nameservers = ['8.8.8.8', '8.8.4.4'],
Optional[Integer[0]] $nameserver_limit = undef,
Array $options = ['rotate', 'timeout:1'],
Optional[Array[String[1]]] $search = undef,
Optional[Stdlib::Fqdn] $domain = undef,
Optional[Array[String[1]]] $sortlist = undef,
Array[String[1]] $custom_lines = [],
Stdlib::Absolutepath $resolver_config_file = '/etc/resolv.conf',
String[1] $resolver_config_file_ensure = 'file',
String[1] $resolver_config_file_owner = 'root',
String[1] $resolver_config_file_group = 'root',
Stdlib::Filemode $resolver_config_file_mode = '0644',
Optional[Variant[Boolean, String[1]]] $resolver_config_backup = undef,
) {
if $search and $domain {
fail('search and domain are mutually exclusive and both have been defined.')
}
# Only 3 nameservers are generally allowed by resolv.conf, so lets ensure that
# (While letting people do interesting things in hiera to generate nameserver lists)
# Also provide a way to override
if $nameserver_limit {
$nameservers_slice = $nameservers[0,$nameserver_limit]
} else {
$nameservers_slice = $nameservers
}
file { 'dnsclient_resolver_config_file':
ensure => $resolver_config_file_ensure,
content => template('dnsclient/resolv.conf.erb'),
path => $resolver_config_file,
owner => $resolver_config_file_owner,
group => $resolver_config_file_group,
mode => $resolver_config_file_mode,
backup => $resolver_config_backup,
}
}
|