Exploring the standard library
One of the oldest-established Puppet Forge modules is puppetlabs/stdlib
, the official Puppet standard library. We looked at this briefly earlier in the chapter when we used it as an example of installing a module with r10k
, but let's look more closely now and see what the standard library provides and where you might use it.
Rather than managing some specific software or file format, the standard library aims to provide a set of functions and resources which can be useful in any piece of Puppet code. Consequently, well-written Forge modules use the facilities of the standard library rather than implementing their own utility functions which do the same thing. You should do the same in your own Puppet code—when you need a particular piece of functionality, check the standard library first to see if it solves your problem, rather than implementing it yourself.
Safely installing packages with ensure_packages
As you know, you can install a package using the package...