Forge Home

resolver

Manage resolver configuration

333 downloads

333 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

  • 1.0.0 (latest)
released Jul 15th 2022
This version is compatible with:
  • Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 8.0.0
  • , , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'puppetfinland-resolver', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppetfinland-resolver
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppetfinland-resolver --version 1.0.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

Documentation

puppetfinland/resolver — version 1.0.0 Jul 15th 2022

puppet-resolver

Manage DNS resolver configurations on Linux and Windows systems. The module supports several different methods of DNS resolver configuration:

  • dhclient
  • sysconfig
  • systemd-resolved
  • windows

Other methods can be added relatively easily.

Sane defaults for the DNS resolver method have been provided for all supported operating systems:

  • Ubuntu 16.04 (dhclient)
  • Ubuntu 18.04, 20.04, 22.04 (systemd-resolved)
  • CentOS/Red Hat 7 (sysconfig)
  • CentOS/Rocky/Red Hat 8 (sysconfig)
  • Windows (windows)

However, should the defaults fail the method can be selected manually.

General usage

In most cases you should be able to just use the defaults:

class { 'resolver':
  servers => ['10.10.10.1', '10.10.10.2'],
  domains => ['example.org', 'example.com'],
}

Note that some methods do not supports the domains parameter at all, or may only support it partially.

Note that method defaults only works for the officially supported operating systems, that is, those that have proper module-level Hiera data. On unsupported operating systems catalog configuration will fail unless you explicitly define the method parameter.

Also note that the default methods may not be correct in all cases. For example some Cloud images may be configured to use different method out of box than what this module expects.

Methods

dhclient

Example usage:

class { 'resolver':
  method  => 'dhclient',
  servers => ['10.10.10.1', '10.10.10.2'],
}

Notes:

  • The domains parameter is not supported

sysconfig

Example usage:

class { 'resolver':
  method    => 'sysconfig',
  servers   => ['10.10.10.1', '10.10.10.2'],
  domains   => ['example.org'],
  interface => 'eth0',
}

Notes:

  • The domains parameter is optional
  • If interface is not defined, Puppet defaults to using the primary network interface ($facts['networking']['primary'])
  • If more than one domain is defined, only the first one is used

systemd-resolved

To configure global settings:

class { 'resolver':
  method    => 'systemd-resolved',
  servers   => ['10.10.10.1', '10.10.10.2'],
  domains   => ['example.org', 'example.com'],
}

Note that global settings may not have the intended effect as per-link settings may take precedence over them.

To configure settings for an interface (this is a wrapper for resolver::systemd_resolved::interface):

class { 'resolver':
  method    => 'systemd-resolved',
  servers   => ['10.10.10.1', '10.10.10.2'],
  domains   => ['example.org', 'example.com'],
  interface => 'eth0',
}

If you need to configure resolvers for more than one interface you can use the resolver::systemd_resolved::interface define:

resolver::systemd_resolved::interface { 'eth0':
  servers   => ['10.10.10.1', '10.10.10.2'],
  domains   => ['example.org', 'example.com'],
  interface => 'eth0',
}

resolver::systemd_resolved::interface { 'eth1':
  servers   => ['10.20.20.1', '10.20.20.2'],
  domains   => ['foo.org', 'bar.com'],
  interface => 'eth1',
}

Notes:

  • The domains parameter is optional
  • Multiple domains are supported
  • If systemd-resolved has already obtained domain information from elsewhere it does not get overwritten (yet). This can cause unexpected behavior and/or flickering on Puppet runs.

windows

Example usage:

class { 'resolver':
  method  => 'windows,
  servers => ['10.10.10.1', '10.10.10.2'],
}

Notes:

  • The domains parameter is not supported

Custom facts

This module contains one custom fact, systemd_resolve_status. If systemd-resolved is running it should contain a hash with DNS settings for each interface. For example:

{
  Global => {
  }
  eth0 => {
    dns_domain => [
      "example.org"
    ],
    dns_servers => [
      "10.10.10.1",
      "10.10.10.2"
    ]
  },
  eth1 => {
    dns_domain => [
      "example.com"
    ],
    dns_servers => [
      "10.20.20.1",
      "10.20.20.2"
    ]
  },
  eth2 => {
    dns_servers => [
      "10.30.30.1",
      "10.30.30.2"
    ]
  },
  eth3 => {
  }
}