Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


dhcp-wrapper (5) Versions 1.4.0

Wrapper around dhcp cookbook

cookbook 'dhcp-wrapper', '~> 1.4.0', :supermarket
cookbook 'dhcp-wrapper', '~> 1.4.0'
knife supermarket install dhcp-wrapper
knife supermarket download dhcp-wrapper
Quality 50%

DHCP Wrapper


Install and configure ISC DHCP by
wrapping cookbook dhcp.

Can also configure network interfaces by the use of cookbook
network_interfaces_v2, for instance to
set a static address at the server and dhcp for the clients.



Declared in [metadata.rb](metadata.rb) and in [Gemfile](Gemfile).


  • RHEL Family 7, tested on Centos

Note: it should work fine on Debian 8 but the official docker image does not
allow systemd to work easily, so it could not be tested.


Easy Setup

Add recipe[dhcp-wrapper::server] in your run-list to install and configure
DHCPD. Configuration will be fetched from attributes node['dhcp']. See
cookbook dhcp documentation for more information.

Add recipe[dhcp-wrapper::client] to install a dhcp client.

Add recipe[dhcp-wrapper::network_interface] to configure your network
interfaces. Configuration is fetched from attributes
node['dhcp-wrapper']['network-interface'] which should match those of
provider network_interface.

To see an example, look at [.kitchen.yml](.kitchen.yml).


This cookbook is fully tested through the installation of a server and a node
in docker hosts. This uses kitchen, docker and some monkey-patching.

If you run kitchen list, you will see 2 suites, Each corresponds to a different

  • server-centos-7: DHCPD server listening on eth1
  • node-centos-7: generic node with eth1 configured in dhcp

For more information, see [.kitchen.yml](.kitchen.yml) and [test](test)


Configuration is done by overriding default attributes. All configuration keys
have a default defined in [attributes/default.rb](attributes/default.rb).
Please read it to have a comprehensive view of what and how you can configure
this cookbook behavior.

Specific configuration (client or server)

To allow clients and servers to share a same role, it is possible to define
specific configuration keys applicable to one of the status (client or server).

Specific configurations can be any of the attributes defined in
[attributes/default.rb](attributes/default.rb) but in either "client-config"
or "server-config" sub-tree.

A node is declared as server if its FQDN is included in attribute
node['dhcp-wrapper']['servers'] defined as an array. Else, it is considered
as a client.



Call init and then, following the node status, call client or
server recipe.


Determine if the current machine is a server or a client. Write the result
in run_state['dhcp-wrapper']['status']. Then merge default and specific
(client or server) configurations and store the result in

Note: init is included in all recipes.


Install dhclient package.


Proxy for dhcp::server recipe. Please look at [.kitchen.yml](.kitchen.yml)
and dhcp documentation for more information.


Call network_interface_rhel provider based on
attributes node['dhcp-wrapper']['network-interface'].
See [.kitchen.yml](.kitchen.yml) and cookbook
network_interface_v2 for more information.

Create static routes based on node['dhcp-wrapper']['routes'] attribute.






Please read carefully []( before making a merge

License and Author

Copyright (c) 2015-2016 Sam4Mobile, 2018

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

dhcp >= 0.0.0
network_interfaces_v2 >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.




  • massive clean-up following chef-platform standards
  • chore: handover maintenance to


  • test: start Continuous Integration with gitlab-ci
    • test: include .gitlab-ci.yml from test-cookbook
  • test: add a correct Gemfile
  • test: set seccomp (for systemd)
  • test: use kitchen_command.rb from test-cookbook
  • test: replace deprecated require_chef_omnibus


  • chore: set new contributing guide with karma style
  • chore: add foodcritic & rubocop in Gemfile
  • doc: fix markdown in changelog and rename to
  • style(rubocop): fix delimiter offenses
  • style: use cookbook_name macro everywhere



  • Allow clients and servers to share the same role with specific options
    • Add an init recipe which initialize the configuration
    • Modify default to choose between client and server recipe
    • Call network_interface in client and server recipes
    • client specific configurations should be in 'client-config' and servers in 'server-config'.
    • the servers should be defined with 'servers' key
  • Rename network-interface to network_interface: breaking change for users using it directly (very unlikely)
  • Switch to docker_cli, use prepared docker image
    • Switch kitchen driver from docker to docker_cli
    • Use sbernard/centos-systemd-kitchen image instead of bare centos
    • Remove many monkey patches
    • No more need to have sudo access anymore: pipework is gone :)
    • Remove privileged mode :), use --cap-add=NET_ADMIN instead
    • create a docker network: kitchen-dhcp, which is to be controled by the dhcp server


  • Fix and improve tests
    • Modify test cases to test specific option behavior
    • Latest dhcp and strengthen ip check
  • Improve doc, explain specific conf and update it
  • Fix all rubocop offenses


  • Fix idempotency by removing the block hack in network-interface recipe
  • Reorganize README:
    • Move changelog from README to CHANGELOG
    • Move contribution guide to
    • Reorder README, fix Gemfile missing
  • Add Apache 2 license file


  • Add support for static routes


  • Initial version with Centos 7 support

Collaborator Number Metric

1.4.0 passed this metric

Contributing File Metric

1.4.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, and your repo must contain a file

Foodcritic Metric

1.4.0 passed this metric

No Binaries Metric

1.4.0 passed this metric

Testing File Metric

1.4.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, and your repo must contain a file

Version Tag Metric

1.4.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, and your repo must include a tag that matches this cookbook version number