Writing Libraries for Chef

Hands-On Lab


Photo of Keith Thompson

Keith Thompson

DevOps Training Architect II in Content





Within our Chef recipes, we often combine resources with pure Ruby logic to achieve our final configurations. The Ruby logic can sometimes make it difficult to see exactly what is going on in recipes, and this is where it makes sense to extract code out into Chef libraries. In this learning activity, we'll refactor an existing recipe by extracting logic into libraries, to improve the maintainability and readability. By the time we've finished this activity, you should feel more comfortable utilizing Chef libraries to write better Chef code.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.