feat: find resolvers by role
- use puppetdbquery module to query puppetdb for resolvers - move dns client config to profiles::dns::base - manage the /etc/resolv.conf file
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# profiles::dns::base
|
||||
class profiles::dns::base (
|
||||
String $ns_role = undef,
|
||||
Array $search = [],
|
||||
Array $nameservers = ['8.8.8.8', '1.1.1.1'],
|
||||
){
|
||||
|
||||
# if ns_role is set, find all hosts matching that enc_role
|
||||
if $ns_role == undef {
|
||||
$nameserver_array = $nameservers
|
||||
}else{
|
||||
$nameserver_array = query_nodes("enc_role='${ns_role}'", 'networking.ip')
|
||||
}
|
||||
|
||||
# if search is undef, fallback to domainname from facts
|
||||
if $search == [] {
|
||||
$search_array = [$::facts['networking']['domain']]
|
||||
}else{
|
||||
$search_array = $search
|
||||
}
|
||||
|
||||
# include resolvconf class
|
||||
class { 'profiles::dns::resolvconf':
|
||||
nameservers => $nameserver_array,
|
||||
search_domains => $search_array,
|
||||
}
|
||||
|
||||
# export dns records for client
|
||||
profiles::dns::client {"${facts['networking']['fqdn']}-default":}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user