Puppet Module Design
A Puppet module packages reusable configuration policy for one technology or responsibility. Good module design gives users a small typed public interface while hiding implementation classes, data, templates, files, tests, and platform-specific decisions behind it.
itInfrastructure and operations | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Intro
Puppet Module Design
A Puppet module is a reusable policy package. It manages one technology or responsibility and gives other code a stable way to declare that policy.
Good design is not measured by how many classes fit in the module. It is measured by how clearly the module separates its public contract from its implementation.
Start with one responsibility
A component module should answer one question: what system capability does it own?
An nginx module can own package installation, service state, configuration files, and related virtual hosts. It should not also define an organization's entire web application role, database backup policy, and monitoring stack.
Keep business-specific composition in profiles and roles:
role -> profiles -> component modules
A role describes one complete node purpose. Profiles combine component modules into a site-specific layer. Component modules manage technologies through reusable interfaces.
This boundary lets you upgrade or replace a component without rewriting every node classification.
Design the public interface first
A module's public classes and defined types are its API. Users should be able to understand the supported inputs without reading private manifests.
Use typed parameters:
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://help.puppet.com/core/current/Content/PuppetCore/modules_fundamentals.htm
Supports
- Modules as reusable building blocks for one task or technology
- Modulepath loading and supported content types
- https://help.puppet.com/core/current/Content/PuppetCore/style_guide_modules.htm
Supports
- Module structure, metadata, documentation, examples, dependencies, testing, and semantic versioning
- https://help.puppet.com/core/current/Content/PuppetCore/style_guide_classes.htm
Supports
- Typed parameters, public and private classes, defaults, and relationships
- Hiera module data instead of params inheritance
- Opt-in and selective exported resources
- https://help.puppet.com/core/current/Content/PuppetCore/configuring_roles_and_profiles.htm
Supports
- Component, profile, and role layers
- Site-specific composition through profiles and one role classification
- https://help.puppet.com/core/current/Content/PuppetCore/adding_hiera_data_module.htm
Supports
- Namespaced Hiera defaults packaged with modules
- Replacement of params classes with data in modules
- https://help.puppet.com/core/current/Content/PuppetCore/puppet_lookup.htm
Supports
- Global, environment, and module Hiera layers
- First-found and merge behavior
- https://help.puppet.com/core/current/Content/PuppetCore/modules_metadata.htm
Supports
- Required metadata fields and compatibility information
- Semantic versions and bounded dependency ranges
- Operating-system and Puppet requirements
- https://help.puppet.com/pdk/current/topics/create_a_module.htm
Supports
- PDK module skeleton and metadata creation
- https://help.puppet.com/pdk/current/topics/pdk_testing.htm
Supports
- Metadata, syntax, Puppet style, Ruby style, and unit-test tooling
- Testing against maintained Puppet and PE versions
- https://help.puppet.com/pdk/current/topics/unit_testing_modules.htm
Supports
- Catalog compilation and expected-resource unit tests
- Unit-test limits for real managed-system behavior
- https://help.puppet.com/core/current/Content/PuppetCore/bgtm.htm
Supports
- RSpec Puppet, Puppet spec helper, Litmus, documentation, and semantic-release practices
- https://help.puppet.com/core/current/Content/PuppetCore/lang_containment.htm
Supports
- Relationships between containers and contained resources
- https://github.com/awesome-puppet-org/awesome-puppet
Supports
- Selection and descriptions of Puppet VS Code Extension, Vox Pupuli, PuppetModule.info, and Puppet Cookbook
