Coder Social home page Coder Social logo

resolvconf's Introduction

resolvconf Cookbook

This cookbook maintains /etc/resolv.conf using the resolvconf package, which is installed by default on Debian/Ubuntu.

Requirements

A system that supports resolvconf.

  • Ubuntu >= 10.04
  • Debian >= 6.0

Furthermore you need to add the following line to your metadata.rb

depends 'resolvconf'

Attributes

This section describes the supported attributes, as well as their default settings.

Use the following attributes to specify your nameserver(s) to use, the search domain(s) and additional options. Each attribute supports strings, as well as arrays with multiple elements.

node['resolvconf']['nameserver'] = %w(208.67.222.222 208.67.220.220) # Set nameserver(s) to use
node['resolvconf']['search'] = node['domain'] # Set domains to search
node['resolvconf']['options'] = [] # Set options
node['resolvconf']['sortlist'] = ['130.155.160.0/255.255.240.0 130.155.0.0'] # Default is empty

These attributes specify strings that are included in /etc/resolv.conf at head/body/tail.

node['resolvconf']['head'] = [
  '# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)',
  '#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN'
]
node['resolvconf']['base'] = []
node['resolvconf']['tail'] = []

By default, the recipe removes any dns-* configuration lines from /etc/network/interfaces, as they might interferre with the configured settings.

node['resolvconf']['clear-dns-from-interfaces'] = true

You can force the resolvconf cookbook to wipe old entries from the runtime directories. Use this if you have trouble with old resolv.conf entries ending up in your configuration. This is not enabled by default, as it removes the dynamic capabilities of resolvconf which enable applications to change nameserver settings on the fly.

node['resolvconf']['wipe-runtime-directory'] = false

Provider

resolvconf

The LWRP basically supports all options that can be set via attributes, and uses the same defaults. It will do the following

  • It will create the necessary files in /etc/resolvconf/resolv.conf.d/
  • Remove dns-* lines from /etc/network/interfaces (unless clear_dns_form_interfaces is specified)
  • Run 'resolvconf -u'

Before using the provider, you probably want to ensure that the resolvconf package is installed.

include_recipe 'resolvconf::install'

Example:

resolvconf 'default'
resolvconf 'custom' do
  nameserver '8.8.8.8'
  search     'mydomain.com'
  options    'rotate'
  sortlist   'mysortlist'

  head       "# Don't touch this configuration file!"
  base       "# Will be added after nameserver, search, options config items"
  tail       "# This goes to the end of the file."

  # do not touch my interface configuration plz!
  clear_dns_from_interfaces false
end

Recipes

resolvconf:install

Installs the resolvconf package.

resolvconf::default

Includes resolvconf::install, then configures the node using the specified attributes / defaults.

Contributing

Contributions are very welcome!

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors: Chris Aumann [email protected]

License: GPLv3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.