puppet-prod/site/profiles/manifests/dns/client.pp
Ben Vincent fdb13b7338 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
2023-11-17 21:54:20 +11:00

32 lines
829 B
Puppet

# profiles::dns::client
define profiles::dns::client (
Boolean $forward = true,
Boolean $reverse = true,
Integer $order = 10,
){
$intf = $facts['networking']['primary']
$fqdn = $facts['networking']['fqdn']
$last_octet = regsubst($::facts['networking']['ip'], '^.*\.', '')
if $forward {
profiles::dns::record { "${fqdn}_${intf}_A":
value => $::facts['networking']['ip'],
type => 'A',
record => $::facts['networking']['hostname'],
zone => $::facts['networking']['domain'],
order => $order,
}
}
if $reverse {
profiles::dns::record { "${fqdn}_${intf}_PTR":
value => "${::facts['networking']['fqdn']}.",
type => 'PTR',
record => $last_octet,
zone => $::facts['arpa'][$intf]['zone'],
order => $order,
}
}
}