We recently ran into a situation where we needed to use Chef Search to modify our /etc/hosts file dynamically on each Chef run. Originally seeming to be a relatively simple task, managing the hosts file with Chef rose some interesting challenges. While there are a few existing community-maintained /etc/hosts management cookbooks out there, none of them suited our needs. We wanted a highly customiz