cookbook 'resolvconf', '~> 1.0.0'
resolvconf (15) Versions 1.0.0 Follow6
Installs/Configures resolvconf
cookbook 'resolvconf', '~> 1.0.0', :supermarket
knife supermarket install resolvconf
knife supermarket download resolvconf
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 >= 12.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
You can set a list of interfaces that you want to inherit the dns settings from. It creates the
interface-order file /etc/resolvconf/interface-order and builds it from the list.
This enables you to control which additional dns servers if any are added from which interfaces.
ruby
node['resolvconf']['interface-order'] = [
'lo.inet*',
'lo.dnsmasq',
'lo.pdnsd',
'lo.!(pdns|pdns-recursor)',
'lo',
'tun*',
'tap*',
'hso*',
'em+([0-9])?(_+([0-9]))*',
'p+([0-9])p+([0-9])?(_+([0-9]))*',
'eth*',
'ath*',
'wlan*',
'ppp*',
'*'
]
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!
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write you change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
License and Authors
Authors: Chris Aumann me@chr4.org
License: GPLv3
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
CHANGELOG for resolvconf
This file is used to list changes made in each version of resolvconf.
1.0.0:
- Remove default nameservers. Make sure you set them before migrating to this version! See this issue for details.
0.4.0:
- Remove support for Ubuntu 10.04 (Official support ended Q1 2015)
0.3.0:
- Add default interface names for Ubuntu Xenial 16.04
0.2.10:
- Add custom matcher for ChefSpec
0.2.9:
- Use
use_inline_resources
to fix a bug withresolvconf -u
not being immediately called.
0.2.8:
- Allow
wipe_runtime_directory
to be specified as resource attribute. Defaults to node attribute.
0.2.7:
- Add support for interface-order
- Make sure
/etc/resolv.conf
is a symlink to/run/resolvconf/resolv.conf
0.2.6:
-
/run/resolvconf/interface/
is wiped only whennode['resolvconf']['wipe-runtime-directory']
is set totrue
. Defaults to false. This resolves issues with applications using the dynamic nameserver configuration capabilities of resolvconf.
0.2.5:
- Include a workaround for Ubuntu-10.04 (Debian bug #642222)
0.2.4:
- Remove support for the domain attribute, as resolvconf ignores it. Use search attribute instead.
0.2.3:
- Add support for sortlist and domain settings
0.2.2:
- Remove a workaround for
force_unlink
, fix was merged in Chef 11.12.0 - Clear
/run/resolvconf/interface/
directory before updating/etc/resolv.conf
, to prevent deprecated entries from ending up in the file
0.2.1:
- Add small workaround for
force_unlink
bug in Chef, fixed (but not released) in https://github.com/opscode/chef/pull/1383
0.2.0:
- Remove potential symlinks before deploying new configuration
0.1.1:
- Add tests (using kitchen, see TESTING.md)
- Run resolvconf --enable-updates before resolvconf -u (when supported)
- Use Chef::Util::FileEdit instead of execute() and sed
0.1.0:
- Initial release of resolvconf
Collaborator Number Metric
1.0.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.0.0 failed this metric
FC064: Ensure issues_url is set in metadata: resolvconf/metadata.rb:1
FC065: Ensure source_url is set in metadata: resolvconf/metadata.rb:1
FC066: Ensure chef_version is set in metadata: resolvconf/metadata.rb:1
FC069: Ensure standardized license defined in metadata: resolvconf/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: resolvconf/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.0 passed this metric
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.0 failed this metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.0.0 failed this metric
FC064: Ensure issues_url is set in metadata: resolvconf/metadata.rb:1
FC065: Ensure source_url is set in metadata: resolvconf/metadata.rb:1
FC066: Ensure chef_version is set in metadata: resolvconf/metadata.rb:1
FC069: Ensure standardized license defined in metadata: resolvconf/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: resolvconf/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.0 passed this metric
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.0 failed this metric
FC065: Ensure source_url is set in metadata: resolvconf/metadata.rb:1
FC066: Ensure chef_version is set in metadata: resolvconf/metadata.rb:1
FC069: Ensure standardized license defined in metadata: resolvconf/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: resolvconf/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
1.0.0 passed this metric
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.0 failed this metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number