Modules are self-contained, shareable bundles of code and data. Each module manages a
specific task in your infrastructure, such as installing and configuring a piece of software.
With Puppet Enterprise (PE), a lot of your infrastructure is supported by
modules, so it is important to learn how to install, build, and use them. To practice working
with modules, try installing the puppetlabs/apache
module, which automates
installing, configuring, and managing Apache
services.
Tip: You can write your own modules or download pre-built modules from the
Forge. While you can use any module on
the
Forge,
PE customers
can take advantage of supported modules. These modules are designed to facilitate common
services, and they are tested and maintained by
Puppet.
-
Go to the Apache
module page on the Forge.
-
Select r10k or Code Manager as the Installation
Method, and follow the instructions to add the module declaration to
your Puppetfile.
By default, Code Manager installs the latest version and
disables automatic updates; however, you can specify options to install a
different version or keep the module current with the latest version. To
automatically update the module when a new version is released, specify
:latest
(such as mod
'puppetlabs/apache', :latest
). To install a specific version of the
module and prevent automatic updates, specify the version number as a string (such
as mod 'puppetlabs/apache', '5.4.0'
).
-
Make sure your Puppetfile includes module
declarations for the
puppetlabs/stdlib
and puppetlabs/concat
modules, which are dependencies of the
apache
module. Dependencies for each module are
listed on the Dependencies tab on the module’s Forge page, and you can specify the desired
version in the same way you did for the primary module.
For example, this code installs version 5.4.0 of the
apache
module, installs the module's dependencies, and prevents
automatic updates (due to specified version
numbers):
mod 'puppetlabs/apache', '5.4.0'
mod 'puppetlabs/stdlib', '4.13.1'
mod 'puppetlabs/concat', '2.2.1'
-
SSH into your primary server and run
puppet-code deploy --all
to
deploy code.
Results
You installed the apache
module. Installing a module
makes it available in PE so you can use it to manage
nodes.
What to do next
After installing a module, you can run tasks included in the module from the PE console. The apache
module contains a
task that allows you to perform Apache
service functions. To view or run the apache
task in the PE console, go to the Run section,
under Task, and enter apache in the
Task field.
If the apache
task doesn't appear, try refreshing the console in the
browser. If it still does not appear, check that the puppetlabs/apache
module is in your Puppetfile and try again.
To continue managing Apache
configuration on *nix targets,
Set up Apache node groups.