code from "Chef Infrastructure Automation Cookbook"