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.