puppet --configprint modulepath
to see where Puppet expects to find modules on your system.This directory holds the module's Puppet code.
$module_name
variable always contains the module's name.
class apache {
...
}
Init.pp is special; it should contain a class (or define) with the same name as the module.
define apache::vhost ($port, $docroot) {
...
}
Other classes (and defines) should be named modulename::filename
(without the .pp extension).
class apache::config::ssl {
...
}
Subdirectories add intermediate namespaces.
This directory holds Ruby plugins, which can add features to Puppet and Facter.
A custom type.
A custom function.
A custom fact.
Nodes can download any files in this directory from Puppet's built-in file server.
source
attribute to download file contents from the server.puppet:///
URIs to specify which file to fetch.puppet:///modules/modulename/filename
.To fetch this file:
file {'/etc/apache2/httpd.conf':
ensure => file,
source => 'puppet:///modules/apache/httpd.conf',
}
Puppet's file server can navigate any subdirectories:
file {'/etc/apache2/httpd-ssl.conf':
ensure => file,
source => 'puppet:///modules/apache/extra/ssl',
}
This directory holds ERB templates.
template
function to create a string by rendering a template.content
attribute to fill file contents with a string.modulename/filename.erb
.To use this template:
file {'/etc/apache2/sites-enabled/wordpress.conf':
ensure => file,
content => template('apache/vhost.erb'),
}