Forge Home

dns

Module for provisioning DNS (bind9)

2,178 downloads

2,178 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 3.1.0 (latest)
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

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'sourcedoctor-dns', '3.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add sourcedoctor-dns
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install sourcedoctor-dns --version 3.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: bind, dns, bind9

Documentation

sourcedoctor/dns — version 3.1.0 Jul 25th 2020

Puppet DNS (BIND9) Module

Build Status

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']
}