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.0

Configures hostname and FQDN

cookbook 'hostname', '= 0.4.0'
cookbook 'hostname', '= 0.4.0', :supermarket
knife cookbook site install hostname
knife cookbook site download hostname
Quality 67%

hostname 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:


  • 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.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.0 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.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

0.4.0 failed this metric

FC064: Ensure issues_url is set in metadata: hostname/metadata.rb:1
FC065: Ensure source_url is set in metadata: hostname/metadata.rb:1
FC066: Ensure chef_version is set in metadata: hostname/metadata.rb:1
Run with Foodcritic Version 10.3.1 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric

0.4.0 passed this metric

No Binaries Metric

0.4.0 passed this metric

Publish Metric

0.4.0 passed this metric

Supported Platforms Metric

0.4.0 passed this metric

Testing File Metric

0.4.0 passed this metric

Version Tag Metric

0.4.0 passed this metric