Functions
Functions are sections of Ruby code that can be run during catalog compilation and allow you to modify the catalog or calculate and return values. Puppet has many built-in functions and more can be supplied via modules from Puppet Forge, such as https://forge.puppet.com/modules/puppetlabs/stdlib, or custom-written functions added to modules. This book will not cover writing functions, but a complete guide can be found at https://puppet.com/docs/puppet/latest/writing_custom_functions.html.
In this section, we will cover the three different types of functions: statement, prefix, and chained. A selection of the core Puppet functions will be shown, grouped by purpose to demonstrate the most used and useful functions.
Note
A lot of functions were moved from sources such as the stdlib
module into the core Puppet function. The full list can be reviewed at https://puppet.com/docs/puppet/6/release_notes_puppet.html#release_notes_puppet_x-0-0.
Statement functions
Statement...