11
Jan

Create Puppet modules using Classes

A Puppet module is a reusable unit of manifest code, similar to functions or methods in procedural languages. A Puppet module can be defined in either of the following ways:

  1. Using classes
  2. Using defined types

In this article, I’m going to explain how to create a Puppet module using Classes. A Puppet class can be considered to be a container for resources. It is defined once and selected by all nodes that need to make use of the prepared functionality. Each class represents a well-known subset of a system’s configuration.

Here is the syntax of the class.

1
 class name { type {‘name’: attribute => value, } type {‘name’: attribute => value, } }
First thing you need to do is to create directory structure for your module. It needs to be created under “modules” directory present in your Puppet home directory (on most of the systems, Puppet home directory is /etc/puppet)

Here are step by step instructions: Continue reading