chef_hostname cookbook

Since I was deeply unsatisfied with all the hostname cookbooks out there I wrote a new one.

The main features are:

  • substantially more portable (fixes for Docker and stuff like that)
  • written as a resource, not a recipe
  • by default coerces itself to run at compile_time so you don’t have to fix every other cookbook in existence to lazy { node['fqdn'] }
  • it manages the hosts line in /etc/hosts and lets you override the IP and/or turn this feature off
  • it supports FQDNs as hostnames
  • i’ve gone through the outstanding PRs and issues on the hostname cookbook and I believe I’ve addressed everything that is in-scope.

The ultimate goal of this cookbook is to RFC it for inclusion into core chef and have a supported, official, correct way of setting the hostname on a server via Chef.

The Windows part of the cookbook is busted, I’m working on that.

I probably won’t support the reading-the-hostname-from-vmware code since that should just get baked into an ohai attribute if its not already.

https://supermarket.chef.io/cookbooks/chef_hostname

Awesome stuff!

there’s some missteps on the links in supermarket back to the codebase, and a couple FC issues, but overall it looks awesome.

Now if only I was fully on Chef 12.…

-M

fixed.

Nice! Would be awesome to see this get included in core. I’ve been using the system cookbook for setting the hostname.