Creating modules
PDK generates a complete new module with metadata, as well as creating classes, defined types, and tasks in your module. It also sets up infrastructure for validating and unit testing your module.
To create your module's metadata, PDK asks you a series of questions. Each question
has a default response that PDK uses if you skip the question. The answers you provide to these questions
are stored and used as the new defaults for subsequent module creations. Optionally, you
can skip the interview step and use the default answers for all metadata. For details
about editing the metadata.json
file, read about Module metadata.
PDK generates the empty module based on a default template, but you can specify your own custom template with command line options. To see the complete default module template, see the pdk-templates project on GitHub.
When you run the pdk new module
command, it requests the following
information:
-
Your Puppet Forge user name. If you don't have a Forge account, you can accept the default value for this question. If you create an account later, edit the module metadata manually with the correct value.
-
Module version. We use and recommend semantic versioning for modules.
-
Your name.
-
The license under which your module is made available. Use an identifier from SPDX License List.
-
A list of operating systems your module supports.
-
A one-sentence summary about your module.
-
The URL to your module's source code repository, so that other users can contribute back to your module.
-
The URL to a web site that offers full information about your module, if you have one.
-
The URL to the public bug tracker for your module, if you have one.
After you have validated the module, you can create classes, defined
types, and tasks to your module by running pdk
commands.
The new class and defined type commands create manifest and a test file templates for the class or defined type.
The new task command creates task and task metadata templates. When
you create a task, PDK creates
a task file in shell script (<TASK>.sh
), but you can write tasks in any language the target nodes
will run. Be sure you use the correct extension for the language you write tasks in. For
more information about tasks, see the writing tasks documentation.
In this section: