Book Image

Learning Puppet for Windows Server

By : Fuat Ulugay
Book Image

Learning Puppet for Windows Server

By: Fuat Ulugay

Overview of this book

Table of Contents (15 chapters)
Learning Puppet for Windows Server
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The Puppet functions


Functions are predefined codes of Ruby. For example, the template('modulename/templatename') code we used in the templates example is a function that is calling the template file as content. Most of the functions return a value or modify the catalog. In the next section, we will start with the stdlib functions.

The stdlib functions

There are many ready-made functions in the stdlib module. The complete module name is puppetlabs-stdlib. As the module name implies, the stdlib module has many standard definitions that can be used in different modules. In this section, we will just see some of the function examples and how to use them. You can find the full reference from https://forge.puppetlabs.com/puppetlabs/stdlib. To install the module, use the following command in the Puppet Master terminal:

$ sudo puppet module install puppetlabs-stdlib

For the following examples, we will create a sample module named testfunctions. The module will not do anything at all but will display...