Use Chef resources instead of plain ruby code.