Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi there! You should read through the Beginner's Guide to Modules and the Module Fundamentals guides.

There are a lot of 'convention' driven rules about how to place/name your classes so the autoloader will find them.

If you place resources in a whatever.pp file and do puppet apply whatever.pp, it will load any resources it finds. If you want something to load as a module, you need to follow a few rules.

Here is an excerpt from the Module Layout section...

This example module, my_module, shows the standard module layout in more detail:

my_module — This outermost directory’s name matches the name of the module.
manifests/ — Contains all of the manifests in the module.
init.pp — Contains a class definition. This class’s name must match the module’s name.
other_class.pp — Contains a class named my_module::other_class.
my_defined_type.pp — Contains a defined type named my_module::my_defined_type.
implementation/ — This directory’s name affects the class names beneath it.
foo.pp — Contains a class named my_module::implementation::foo.
bar.pp — Contains a class named my_module::implementation::bar.
files/ — Contains static files, which managed nodes can download.
service.conf — This file’s source => URL would be puppet:///modules/my_module/service.conf. Its contents can also be accessed with the file function, like content => file('my_module/service.conf').
lib/ — Contains plugins, like custom facts and custom resource types. These will be used by both the Puppet master server and the Puppet agent service, and they’ll be synced to all agent nodes whenever they request their configurations. See “Using Plugins” for more details.
facts.d/ — Contains external facts, which are an alternative to Ruby-based custom facts. These will be synced to all agent nodes, so they can submit values for those facts to the Puppet master. (Requires Facter 2.0.1 or later.)
templates/ — Contains templates, which the module’s manifests can use. See “Templates” for more details.
component.erb — A manifest can render this template with template('my_module/component.erb').
component.epp — A manifest can render this template with epp('my_module/component.epp').
examples/ — Contains examples showing how to declare the module’s classes and defined types.
other_example.pp — Major use cases should have an example.
spec/ — Contains spec tests for any plugins in the lib directory.

Let us know if you have any additional questions!