Show Table of Contents
2.3. Generating a New Module Boilerplate
The first step in creating a new module is to change to the Puppet module directory and create a basic module structure. Either create this structure manually or use Puppet to create a boilerplate for your module:
# cd /etc/puppet/modules # puppet module generate [module-name]
An interactive wizard appears and guides you through populating the module's
metadata.json file with metadata.
Important
The
puppet module generate command requires module-name take the format of [username]-[module] to comply with Puppet Forge specifications. However, to test our tutorial module and use it with Satellite 6 we need to rename the module directory without the [username]. For example, for dmacpher-mymodule you would run:
# puppet module generate dmacpher-mymodule # mv dmacpher-mymodule mymodule
When the module generation process completes, the new modules contains some basic files, including a
manifests directory. This directory already contains a manifest file called init.pp, which is the module's main manifest file. View the file to see the empty class declaration for the module:
class mymodule {
}
The module also contains a
tests directory containing a manifest also named init.pp. This test manifest contains a reference to the mymodule class within manifests/init.pp:
include mymodule
Puppet will use this test manifest to test our module.
We are now ready to add our system configuration to our module.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.