O'Reilly logo

Learning Puppet 4 by Jo Rhett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. Designing a Custom Module

In this chapter, we will review the process of creating a custom module. We will cover each step from the beginning, including:

  1. Naming a module properly
  2. Generating an empty module skeleton
  3. Writing the base manifest
  4. Identifying files to be copied to the node
  5. Creating templates to customize files on the node
  6. Testing that the module works as expected

Let’s get started.

Choosing a Module Name

A module can have any name that begins with a letter and contains only lowercase letters, numbers, underscores. A hyphen is not allowed within a module name. Here are some valid and invalid module names:

mymodule Valid
3files Invalid
busy_people Valid
busy-people Invalid

It is important to choose your module name carefully to avoid conflicts with other modules. As each module creates its own namespace, only one module may exist within a Puppet catalog with a given name at the same time. For most intents and purposes, this means that you can never use two modules with the same name.

When naming modules, I try to avoid naming the module anything that conflicts with a module name available in the Puppet Forge. I never know when another team might utilize that module for its project, or when a module I download might use the Puppet Forge module as a dependency.

Note
It’s possible to manage conflicting module names by utilizing them within separate environments. We’ll cover how to do this in Chapter 29.

Avoiding Reserved Names

Some namespaces are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required