Modules overview
Modules are directories that contain Puppet code designed to solve a specific use case or manage an application. Many of the modules on the Puppet Forge include helpful plans and tasks that you can install with OpenBolt and use in your workflows. But even if a module doesn’t contain a task or a plan, you can still use OpenBolt to apply code from that module to your targets.
Modules also allow you to share your own custom tasks and plans on the Forge or use your OpenBolt content programmatically.
📖 Related information
Dependency management
Many modules depend on other modules to work properly. When you install a module using the OpenBolt command-line interface (CLI), OpenBolt automatically manages those dependencies for you.
First, OpenBolt adds the module to your project configuration file
(bolt-project.yaml) under a modules key. For example, if you created a
project and added the mysql and apache modules, your bolt-project.yaml
file would contain the following section:
# bolt-project.yaml
...
modules:
- puppetlabs/apache
- puppetlabs/mysql
Next, OpenBolt resolves the modules and their dependencies and generates a Puppetfile. Avoid editing your Puppetfile directly. The Puppetfile for the above project would look like this:
# Puppetfile
...
# The following directive installs modules to the managed moduledir.
moduledir '.modules'
mod 'puppetlabs/apache', '5.6.0'
mod 'puppetlabs/puppetserver_gem', '1.1.1'
mod 'puppetlabs/resource_api', '1.1.0'
mod 'puppetlabs/translate', '2.2.0'
mod 'puppetlabs/stdlib', '6.5.0'
mod 'puppetlabs/mysql', '10.8.0'
mod 'puppetlabs/concat', '6.2.0'
Finally, OpenBolt installs the modules and dependencies to the OpenBolt-managed module
directory (moduledir) in your OpenBolt project directory (.modules):
.modules/
├── apache/
├── concat/
├── mysql/
├── puppetserver_gem/
├── resource_api/
├── stdlib/
└── translate/
📖 Related information
Modulepath
The list of directories where OpenBolt looks for content is called the modulepath. OpenBolt always loads content from:
- The current OpenBolt project.
- Any modules in the configurable modules directory. By default this is
modules/. - The OpenBolt-managed moduledir (
.modules). - Any modules that come bundled with OpenBolt.
If you’d like to modify or add a directory to OpenBolt’s modulepath, add the path to
the directory to a modulepath key in your bolt-project.yaml file. The
modulepath key accepts an array of directories. For example, if you wanted to
load modules from a directory at ../my-modules/modules/ in addition to the
modules directory:
# bolt-project.yaml
...
modulepath:
- modules
- ../my-modules/modules/
If you add a modulepath key and omit modules, OpenBolt will not load content
from the modules directory.
You can see a list of directories and modules OpenBolt is loading from the current modulepath using the following command:
*nix shell command:
bolt module show
PowerShell cmdlet:
Get-BoltModule
Compatibility with older projects and OpenVox Server
Module dependency management affects:
- Older projects that don’t use dependency management yet. For information on how to migrate your OpenBolt project to use dependency management, see Migrate an OpenBolt project.
- Your OpenVox Server environments (if you’re using the dependency management feature).
OpenVox Server compatibility
OpenBolt sets the moduledir in the Puppetfile to .modules/, which is not on an
OpenVox Server environment’s default modulepath. If you’re using OpenBolt’s
dependency management feature in an OpenVox Server environment, you must specify
.modules on the modulepath in your
environment.conf.
For example:
# /etc/puppetlabs/code/environments/test/environment.conf
modulepath = site:dist:modules:$basemodulepath:.modules