Version information
released Jul 25th 2020
This version is compatible with:
- Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 4.6.1 <= 6.0.0
- RedHat, Ubuntu, Debian
Start using this module
Add this module to your Puppetfile:
mod 'sourcedoctor-dns', '3.1.0'
Learn more about managing modules with a PuppetfileDocumentation
sourcedoctor/dns — version 3.1.0 Jul 25th 2020
Puppet DNS (BIND9) Module
Module for provisioning DNS (bind9)
Supports:
- Ubuntu
- Debian
- CentOS
About
This is a partial rewrite of Puppet Module ajjahn puppet-dns to be Hieara capable
The differences/advantages:
- DNS Settings are handled in Class DNS directly and no more in DNS::Server
- Code was rewritten mostly for handling Puppet4 features
- full hiera support
- full support of Debian
- handling of Response Policy Zones
Usage
include dns
include dns::record
node 'server.example.com' {
# DNS Settings and Zone Configuration
class { 'dns':
forwarders => [ '8.8.8.8',
'8.8.4.4' ],
zone => { 'example.com' => {
soa => 'ns1.example.com',
soa_email => 'admin.example.com',
nameservers => ['ns1']
},
'example2.com' => {
soa => 'ns2.example2.com',
soa_email => 'admin.example2.com',
nameservers => ['ns2']
},
}
}
# A Records:
dns::record::a {
'huey':
zone => 'example.com',
data => ['98.76.54.32'];
'duey':
zone => 'example.com',
data => ['12.34.56.78', '12.23.34.45'];
'luey':
zone => 'example.com',
data => ['192.168.1.25'],
ptr => true; # Creates a matching reverse zone record. Make sure you've added the proper reverse zone in the manifest.
}
# MX Records:
dns::record::mx {
'mx,0':
zone => 'example.com',
preference => 0,
data => 'ASPMX.L.GOOGLE.com';
'mx,10':
zone => 'example.com',
preference => 10,
data => 'ALT1.ASPMX.L.GOOGLE.com';
}
# NS Records:
dns::record::ns {
'example.com':
zone => 'example.com',
data => 'ns3';
'delegation-to-ns4-jp-example-net':
zone => 'example.com',
host => 'delegated-zone',
data => 'ns4.jp.example.net.';
}
# CNAME Record:
dns::record::cname { 'www':
zone => 'example.com',
data => 'huey.example.com',
}
# TXT Record:
dns::record::txt { 'www':
zone => 'example.com',
data => 'Hello World',
}
# TSIG
class { 'dns':
tsig => { 'ns3' :
ensure => present,
algorithm => "hmac-md5",
secret => "La/E5CjG9O+os1jq0a2jdA==",
server => "192.168.1.3"
}
}
}
You can also declare forwarders for a specific zone, if you don't have one in the dns::option.
class { 'dns':
zone => { 'example.com' => {
soa => 'ns1.example.com',
soa_email => 'admin.example.com',
allow_forwarder => ['8.8.8.8'],
forward_policy => 'first',
nameservers => ['ns1']
},
}
}
You can change the checking of the domain name. The policy can be either warn fail or ignore.
class { 'dns':
check_names_master => 'fail',
check_names_slave => 'warn',
forwarders => [ '8.8.8.8',
'8.8.4.4' ],
}
You can enable the report of bind stats trough the statistics-channels
using:
class { 'dns':
check_names_master => 'fail',
check_names_slave => 'warn',
forwarders => [ '8.8.8.8', '4.4.4.4' ],
statistic_channel_ip => '127.0.0.1',
statistic_channel_port => 8053
}
You can also create dynamic zones. Mind they are only created once by puppet and never replaced unless allow_update is empty.
class { 'dns':
zone => { 'example.com' => {
soa => 'ns1.example.com',
soa_email => 'admin.example.com',
allow_forwarder => ['8.8.8.8'],
allow_update => ['192.168.1.2', '192.168.1.3'],
forward_policy => 'first',
nameservers => ['ns1'],
},
}
}
Create a DNS forwarder and overrule rules with the response-policy. This is supported from BIND 9.8+
include dns
include dns::record
class { 'dns':
forwarders => ['8.8.8.8', '8.8.4.4'],
response_policy_zones => ['rpz'],
zone => { 'rpz': }
}
dns::record::a {
'test.example.tld.':
zone => 'rpz',
data => ['127.0.0.1']
}
Dependencies
- puppetlabs/concat (>=2.0.0)
- puppetlabs/stdlib (>=2.4.0 <6.0.0)
MIT License Copyright (c) 2018 SourceDoctor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.