Skip to content

Module for provisioning DNS (bind9) - hiera capable version

License

Notifications You must be signed in to change notification settings

SourceDoctor/puppet-dns

This branch is 11 commits ahead of, 6 commits behind ajjahn/puppet-dns:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b2b78ea · Jan 27, 2025
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Dec 12, 2021
Jul 25, 2020
Aug 2, 2023
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Feb 26, 2018
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jul 25, 2020
Jan 27, 2025

Repository files navigation

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

About

Module for provisioning DNS (bind9) - hiera capable version

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Puppet 69.3%
  • HTML 18.6%
  • Ruby 11.8%
  • Shell 0.3%