Book Image

Mastering Puppet

By : Thomas Uphill
Book Image

Mastering Puppet

By: Thomas Uphill

Overview of this book

Table of Contents (17 chapters)

Chapter 6. Custom Types

Puppet is about configuration management. As you write more and more code in puppet, patterns will begin to emerge—sections of code that repeat with only minor differences. If you were writing your code in a regular scripting language, you'd reach for a function or subroutine definition at this point. Puppet, like other languages, supports the blocking of code in multiple ways; where you'd reach for functions, you can use defined types; and where you might overload an operator, you can use a parameterized class. In this chapter, we will show you how to use parameterized classes and introduce the define function to define new user-defined types. Following that we will introduce custom types written in Ruby.