Installing modules from the command line

The puppet module install command installs a module and all of its dependencies. You can install modules from the Forge, a module repository, or a release tarball.

By default, this command installs modules into the first directory in the Puppet modulepath, which defaults to $codedir/environments/production/modules. For example, to install the puppetlabs-apache module, run:

puppet module install puppetlabs-apache

You can customize the module version, installation directory, or environment, get debugging information, or ignore dependencies by passing options with the puppet module install command.

If any installed module has an invalid version number, Puppet issues a warning:
Warning: module (/Users/youtheuser/.puppet/modules/module) has an invalid 
version number (0.1). The version has been set to 0.0.0. If you are the maintainer for this module, please update the 
metadata.json with a valid Semantic Version (http://semver.org).
Despite the warning, Puppet still downloads your module and does not permanently change the module's metadata. The version is changed only in memory during the run of the program, so that Puppet can calculate dependencies.

For Premium Content offerings, you must log in to the Forge to access the module.

Installing modules from the Forge by using an internet connection

To install a module from the Forge by using an internet connection, run the puppet module install command with the long name of the module. The long name of a module is formatted as <username>-<modulename>. For example, to install puppetlabs-apache, run:

puppet module install puppetlabs-apache

Installing modules from the Forge in an air-gapped environment

You can install a module in an air-gapped environment in which the host server does not have internet access. In the following instructions, Security Compliance Enforcement (SCE) for Linux is used as an example. However, the general process applies to all Puppet modules.

  1. If the module is a Premium Content offering (like the SCE modules), log in to Puppet Forge to gain access to the module.
  2. In Puppet Forge, locate the module and download the release tarball. In the Installation Method list, click Direct download and Download.
  3. Copy the downloaded tarball to the appropriate location. The location will be either the primary Puppet server and each compiler, or the source repository that hosts your control repository.
  4. Install the Puppet module by using one of the following methods:
    • Direct installation using the puppet module install command. You can install the module either into your Puppet environment or your control repository. Run a command that is similar to the following example, but specify the file, directory, and module that you require:
      puppet module install ./puppetlabs-cem_linux-1.6.1.tar.gz --ignore-dependencies --modulepath </path/to/your/modules>
    • Manual installation using a tar command. Run a command that is similar to the following example, but specify the file, directory, and module that you require:
      tar zxvf puppetlabs-cem_linux-1.6.1.tar.gz && mv puppetlabs-cem_linux </path/to/your/modules>/cem_linux
  5. For any module dependencies, repeat steps through 1-4.
  6. If you installed the module to your control repository, commit and push the changes.

Installing from another module repository

You can install modules from other repositories that mimic the Forge interface. You can change the module repository for one installation, or you can change your default repository.

To change the module repository for a single module installation, specify the base URL of the repository on the command line with the --module_repository option. For example:

puppet module install --module_repository http://dev-forge.example.com puppetlabs-apache
To change the default module repository, edit the module_repository setting in the puppet.conf to the base URL of the repository you want to use. The default value for the module_repository is the Forge URL, https://forgeapi.puppetlabs.com. See the module_repository setting in the puppet.conf configuration documentation.

Installing from a release tarball

To install a module from a release tarball, specify the path to the tarball instead of the module name.

If you cannot connect to the Forge, or you are installing modules that have not yet been published to the Forge, use the --ignore-dependencies option and manually install any dependencies. For example:

puppet module install ~/puppetlabs-apache-0.10.0.tar.gz --ignore-dependencies

Installing and upgrading Puppet Enterprise-only modules

Some Puppet modules are available only to PE users. Generally, you manage these modules in the same way you would manage other modules. You can use these modules with licensed PE nodes, a PE 10-node trial license, or with Bolt for a limited evaluation period. See your module's license for complete details.