Forge Home

resolv_conf

Manage /etc/resolv.conf

15,665 downloads

1,259 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

  • 2.1.2 (latest)
  • 2.1.1
  • 2.1.0
  • 2.0.0
  • 1.2.0
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Aug 27th 2021
This version is compatible with:
  • Puppet Enterprise 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
  • Puppet >= 5.5.10 < 8.0.0
  • CentOS, Debian, FreeBSD, OracleLinux, RedHat, SLES, Ubuntu

Start using this module

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

Add this module to your Puppetfile:

mod 'stm-resolv_conf', '2.1.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add stm-resolv_conf
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install stm-resolv_conf --version 2.1.2

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

stm/resolv_conf — version 2.1.2 Aug 27th 2021

resolv_conf

Build Status Puppet Forge License

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with resolv_conf
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Development - Guide for contributing to the module

Overview

Manage the /etc/resolv.conf on Linux and FreeBSD.

Module Description

The module manages the DNS resolver configuration file. It allows setting the values for the nameserver, domain, search, sortlist and options configuration settings. The following restrictions are enforced by the module:

  • Up to 3 name servers may be listed.
  • Up to 6 items may be included in the search list.
  • Up to 10 items may be included in the sortlist.
  • The domain and search keywords are mutually exclusive.

Setup

What resolv_conf affects

The module creates and manages the content of the /etc/resolv.conf file. This affects the way the host is able to map hostname to IP addresses and vice versa.

Setup Requirements

The module uses the Puppet stdlib module.

Beginning with resolv_conf

Declare the class to create a configuration that uses only a local name server on 127.0.0.1.

class { 'resolv_conf': }

Usage

You can use class parameters to use a customized configuration.

class { 'resolv_conf':
  nameservers => [ '9.9.9.9', ],
}

You can also use Hiera to create this configuration.

resolv_conf::nameservers:
  - '9.9.9.9'

Specify a remote name server and use local domain for unqualified hostnames

The following configuration will configure a remote name server and use the name of the local domain when unqualified hostnames are queried.

class { 'resolv_conf':
  nameservers => [ '9.9.9.9', ],
  domain      => $::domain,
}

If your host is based in the example.net domain, then a lookup for the hostname server will query the name server for server.example.net.

Specify name servers & options

This setup creates a configuration file with the given name servers and will also set additional options to enable name server rotation and set a specific timeout.

class { 'resolv_conf':
  nameservers => [ '8.8.8.8', '8.8.4.4', ],
  options     => [ 'rotate', 'timeout:2', ],
}

Prefer a local name server

The following setup will create a configuration where the name server at 127.0.0.1 is queried first and only then the additional name servers are used.

class { 'resolv_conf':
  nameservers              => [ '8.8.8.8', '8.8.4.4', ],
  prepend_local_nameserver => true,
}

Note: This module does not configure a local name server that will answer queries on 127.0.0.1. You will have to use a different Puppet module to manage the name server.

Reference

See REFERENCE.md

Development

You may open Github issues for this module if you need additional options currently not available.

Feel free to send pull requests for new features.