Custom functions

This is where custom facts allow us to run arbitrary code on the client side. Custom functions are a server-side technology that assist you in the compilation of a catalog. Functions are executed on the Puppet server. Puppet already includes several functions that are built-in, and additional ones are contained in Puppet Forge modules, particularly the stdlib module (see https://forge.puppet.com/puppetlabs/stdlib).

There are, in fact, three possible ways to create custom functions, although you are unlikely to use the first two, so I will just leave you with some links to the Puppet documentation for those options:

Get Mastering Puppet 5 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.