Book Image

LEARNING PUPPET

Book Image

LEARNING PUPPET

Overview of this book

Table of Contents (17 chapters)
Learning Puppet
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The parameterized class


The class parameter is a mechanism to alter the default behavior of a Puppet class. Typically, parameters are some kind of configuration information that is provided to the class when it is instantiated. For example, installing a database server with a parameterized Puppet class could provide you a parameter that defines how much memory to allocate to the database server process. Or, if a database server process should run as a certain user, you could provide a user parameter to the class, which will then create the user account and start the process as the user.

Calling a class with parameters

When calling a class without parameters, we will use the include keyword followed by the class name, for example, include apache.

When calling a class with parameters, the include key word is replaced with the key word class and the syntax used with class key word becomes analogous to any other type of Puppet resource. For example, by calling a class bicycle with the parameter...