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


hostname (11) Versions 0.4.2

Configures hostname and FQDN

cookbook 'hostname', '~> 0.4.2'
cookbook 'hostname', '~> 0.4.2', :supermarket
knife supermarket install hostname
knife supermarket download hostname
Quality 75%

hostname cookbook

Build Status Chef cookbook


Sets hostname and FQDN of the node. The latest code is hosted at


Setting hostname on FQDN is not (and won't be) supported. Unfortunately, using dots in the hostname can cause inconsistent results for any system that consumes DNS and is not allowed by RFC952. If a user needs additional info in their shell prompt, they can change PS1 in etc/profile to include the FQDN together with any information they find useful (such as the customer, the environment, etc).


  • node['set_fqdn'] - FQDN to set.

The asterisk character will be replaced with This way, you can add this to base role:

default_attributes :set_fqdn => '*'

and have node set its FQDN and hostname based on its chef node name (which is provided on chef-client first run's command line).

  • node['hostname_cookbook']['hostsfile_ip'] -- IP used in /etc/hosts to correctly set FQDN (default:
  • node['hostname_cookbook']['hostsfile_aliases'] -- list of aliases used in /etc/hosts for the ip set above (default: [hostname])
  • node['hostname_cookbook']['hostsfile_include_hostname_in_aliases'] -- whether to include the hostname at the end of the aliases list above (default: true)

  • node['hostname_cookbook']['append_hostsfile_ip'] -- Set to false to prevent an entry for the node's hostname from being appended in /etc/hosts (default: true)


  • hostname::default -- will set node's FQDN to value of set_fqdn attribute, and hostname to its host part (up to first dot).
  • hostname::vmware -- sets hostname automatically using vmtoolsd. You do not need to set node["set_fqdn"].


Author: Maciej Pasternacki

Change History

0.4.2 (2017-05-04)

  • #51: Make host file idempotent on RHEL
  • #52: Add append_hostsfile_ip logic for improved idempotence
  • #55: Ensure sysctl kernel.hostname set correctly on RHEL

0.4.1 (2017-04-24)

  • #43: Set unique hosts file entry for hostname
  • #44: Make hostname mapping to optional
  • #59: Updates to resolve deprecations warnings
  • #60, #61: various test fixes

0.4.0 (2015-03-16)

  • #40: Use file resources with lazy eval and notifies to prevent network restarts from occurring on every chef run (Matt Kasa)
  • Add box with Ubuntu 14.04 for kitchen tests
  • #27: Update default recipe to reload only the hostname plugin instead of ohai (Jonathan Serafini)

0.3.0 (2014-05-20)

  • Fixed (and tested) FreeBSD support
  • #17: added support for RedHat & CentOS (Damien Roche, Marta Paciorkowska)
  • added instructions on manual testing with reboot (Marta Paciorkowska)


  • Refresh and fix tests, add Rubocop style checks (Marta Paciorkowska)
  • #16: do not remove existing /etc/hosts entries on, use configurable IP for hostname entry we need to have for ourselves (Jean Mertz, Marta Paciorkowska)


  • Tests: chefspec, test-kitchen
  • Substitute * in set_fqdn with to allow fully automatic FQDN setup.


  • Clean up backup files from release


  • Added change log
  • metadata.rb explicitly states cookbook name (Chulki Lee)
  • New recipe hostname::vmware (tily)
  • Use hostsfile cookbook to manipulate /etc/hosts, use instead of trying to figure out own IP (Guilhem Lettron)


  • Use attribute levels when setting for Chef 11 compatibility (Alan Wilhelm)


  • Syntax fix for compatibility with Ruby 1.9.2

0.0.2 and before

This is prehistory.

Collaborator Number Metric

0.4.2 failed this metric

Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric

0.4.2 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

0.4.2 passed this metric

No Binaries Metric

0.4.2 passed this metric

Publish Metric

0.4.2 passed this metric

Supported Platforms Metric

0.4.2 passed this metric

Testing File Metric

0.4.2 passed this metric

Version Tag Metric

0.4.2 passed this metric