Custom resources

There are two ways to define custom resources – via LWRPs (lightweight resource providers) or HWRPs (heavyweight resource providers). Before LWRPs were introduced, all extensions to Chef were written using Ruby, and these are referred to as HWRPs. While LWRPs are simple, a HWRP is extremely flexible. The HWRPs reside in the libraries folder of the cookbook repository. Chef tries to import anything residing there at runtime and is interpreted as code, rather than a Chef DSL. We'll mostly be concerned with LWRPs in this chapter.

A LWRP is meant to extend chef-client so that custom actions can be defined and eventually used in a recipe.

A LWRP has two main components. They are as follows:

  • A lightweight resource that defines a set of ...

Get Mastering Chef now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.