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 could 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.
Before trying the examples in this section, make sure the stdlib
module is installed by following...