PUPPET-MODULE(8)

πŸŽ€ puppet-module πŸŽ€

okay bestie, welcome to PUPPET-MODULE(8) from the Puppet manual β€” yes it's section 8, yes it's a whole vibe, and yes we're doing this together πŸ’–


✨ NAME ✨

puppet-module β€” Creates, installs and searches for modules on the Puppet Forge. πŸ’…


✨ SYNOPSIS ✨

puppet module action [--environment production ] [--modulepath ]

🌸 DESCRIPTION 🌸

So this subcommand? It's the whole module-girlie toolkit. It can find, install, and manage modules from the Puppet Forge β€” which is, like, a repository of user-contributed Puppet code, iykyk. πŸ¦‹

It can also generate empty modules (blank canvas era ✨) and prepare locally developed modules for release on the Forge. Main character energy fr fr.


πŸ’… OPTIONS πŸ’…

okay so heads up: any setting that's valid in the configuration file is also a valid long argument, though it may or may not be relevant to the present action. For example, server and run_mode are valid settings, so you can specify --server <servername>, or --run_mode <runmode> as an argument. 🫢

See the configuration file documentation at https://puppet.com/docs/puppet/latest/configuration.html for the full list of acceptable parameters. A commented list of all configuration options can also be generated by running puppet with --genconfig. (yes that's a real flex, go look πŸ”₯)

  • --render-as FORMAT β€” the format the output gets rendered in. The most common formats are json, s (string), yaml, and console, but other options such as dot are sometimes available. pick your aesthetic ✨
  • --verbose β€” whether to log verbosely. (chatty mode on πŸ’¬)
  • --debug β€” whether to log debug information. (chatty mode but unhinged πŸ’€)
  • --environment production β€” the environment in which Puppet is running. For clients, such as puppet agent, this determines the environment itself, which Puppet uses to find modules and much more. For servers, such as puppet server, this provides the default environment for nodes that Puppet knows nothing about. πŸ‘‘

When defining an environment in the [agent] section, this refers to the environment that the agent requests from the primary server. The environment doesn't have to exist on the local filesystem because the agent fetches it from the primary server. This definition is used when running puppet agent. 🐝

When defined in the [user] section, the environment refers to the path that Puppet uses to search for code and modules related to its execution. This requires the environment to exist locally on the filesystem where puppet is being executed. Puppet subcommands, including puppet module and puppet apply, use this definition. 🌸

Given that the context and effects vary depending on the config section https://puppet.com/docs/puppet/latest/config_file_main.html#config-sections in which the environment setting is defined, do not set it globally. 🚨

  • --modulepath β€” the search path for modules, as a list of directories separated by the system path separator character. (The POSIX path separator is : , and the Windows path separator is ; .) 🧚

Setting a global value for modulepath in puppet.conf is not allowed (but it can be overridden from the commandline). Please use directory environments instead. If you need to use something other than the default modulepath of <ACTIVE ENVIRONMENT'S MODULES DIR>:$basemodulepath, you can set modulepath in environment.conf. For more info, see https://puppet.com/docs/puppet/latest/environments_about.html 🫢


🌈 ACTIONS 🌈

changes β€” Show modified files of an installed module. πŸ”

SYNOPSIS

puppet module changes path

DESCRIPTION

Shows any files in a module that have been modified since it was installed. This action compares the files on disk to the md5 checksums included in the module's checksums.json or, if that is missing, in metadata.json. πŸ‘€

RETURNS

Array of strings representing paths of modified files. πŸ’–


install β€” Install a module from the Puppet Forge or a release archive. πŸ“¦

SYNOPSIS

puppet module install [--force | -f] [--target-dir DIR | -i DIR] [--ignore-dependencies] [--version VER | -v VER] name

DESCRIPTION

Installs a module from the Puppet Forge or from a release archive file.

Note: Module install uses MD5 checksums, which are prohibited on FIPS enabled systems. 😭

The specified module will be installed into the directory specified with the --target-dir option, which defaults to the first directory in the modulepath.

OPTIONS

  • --force | -f β€” Force overwrite of existing module, if any. Implies --ignore-dependencies. πŸ’…
  • --ignore-dependencies β€” Do not attempt to install dependencies. Implied by --force.
  • --target-dir DIR | -i DIR β€” The directory into which modules are installed; defaults to the first directory in the modulepath.

Specifying this option will change the installation directory, and will use the existing modulepath when checking for dependencies. If you wish to check a different set of directories for dependencies, you must also use the --environment or --modulepath options. 🌸

  • --version VER | -v VER β€” Module version to install; can be an exact version or a requirement string, eg >= 1.0.3. Defaults to latest version. ✨

RETURNS

Pathname object representing the path to the installed module. πŸŽ€


list β€” List installed modules πŸ“‹

SYNOPSIS

puppet module list [--tree]

DESCRIPTION

Lists the installed puppet modules. By default, this action scans the modulepath from puppet.conf's [main] block; use the --modulepath option to change which directories are scanned. πŸ‘‘

The output of this action includes information from the module's metadata, including version numbers and unmet module dependencies. πŸ¦‹

OPTIONS

  • --tree β€” Whether to show dependencies as a tree view 🌳

RETURNS

hash of paths to module objects


uninstall β€” Uninstall a puppet module. πŸ—‘οΈ

SYNOPSIS

puppet module uninstall [--force | -f] [--ignore-changes | -c] [--version=] name

DESCRIPTION

Uninstalls a puppet module from the modulepath (or a specific target directory).

Note: Module uninstall uses MD5 checksums, which are prohibited on FIPS enabled systems. 😭

OPTIONS

  • --force | -f β€” Force the uninstall of an installed module even if there are local changes or the possibility of causing broken dependencies. πŸ’€
  • --ignore-changes | -c β€” Uninstall an installed module even if there are local changes to it. (Implied by --force.)
  • --version= β€” The version of the module to uninstall. When using this option, a module matching the specified version must be installed or else an error is raised. 🚨

RETURNS

Hash of module objects representing uninstalled modules and related errors.


upgrade β€” Upgrade a puppet module. ⬆️

SYNOPSIS

puppet module upgrade [--force | -f] [--ignore-dependencies] [--ignore-changes | -c] [--version=] name

DESCRIPTION

Upgrades a puppet module.

Note: Module upgrade uses MD5 checksums, which are prohibited on FIPS enabled systems. 😭

OPTIONS

  • --force | -f β€” Force the upgrade of an installed module even if there are local changes or the possibility of causing broken dependencies. Implies --ignore-dependencies. πŸ’…
  • --ignore-changes | -c β€” Upgrade an installed module even if there are local changes to it. (Implied by --force.)
  • --ignore-dependencies β€” Do not attempt to install dependencies. Implied by --force.
  • --version= β€” The version of the module to upgrade to. ✨

RETURNS

Hash

πŸŽ€ EXAMPLES πŸŽ€

Okay bestie, this is the fun part β€” the receipts. Here's what all those actions actually look like when you run them πŸ’…


✨ changes ✨

Wanna see which files in an installed module got messed with? Say less:

$ puppet module changes /etc/puppet/code/modules/vcsrepo/
warning: 1 files modified
lib/puppet/provider/vcsrepo.rb

✨ install ✨

Install a module, plain and simple:

$ puppet module install puppetlabs-vcsrepo
Preparing to install into /etc/puppet/code/modules ...
Downloading from https://forgeapi.puppet.com ...
Installing -- do not interrupt ...
/etc/puppetlabs/code/modules
└── puppetlabs-vcsrepo (v0.0.4)

Install it into a specific environment instead:

$ puppet module install puppetlabs-vcsrepo --environment development
Preparing to install into /etc/puppet/code/environments/development/modules ...
Downloading from https://forgeapi.puppet.com ...
Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/development/modules
└── puppetlabs-vcsrepo (v0.0.4)

Install one exact version, because you're picky and that's your right:

$ puppet module install puppetlabs-vcsrepo -v 0.0.4
Preparing to install into /etc/puppetlabs/modules ...
Downloading from https://forgeapi.puppet.com ...
Installing -- do not interrupt ...
/etc/puppet/code/modules
└── puppetlabs-vcsrepo (v0.0.4)

Install into a directory of your choosing:

$ puppet module install puppetlabs-vcsrepo --target-dir=/usr/share/puppet/modules
Preparing to install into /opt/puppetlabs/puppet/modules ...
Downloading from https://forgeapi.puppet.com ...
Installing -- do not interrupt ...
/opt/puppetlabs/puppet/modules
└── puppetlabs-vcsrepo (v0.0.4)

Install into your chosen directory and go look for dependencies in other directories too:

$ puppet module install puppetlabs-vcsrepo --target-dir=/usr/share/puppet/modules --modulepath /etc/puppet/code/modules
Preparing to install into /opt/puppetlabs/puppet/modules ...
Downloading from https://forgeapi.puppet.com ...
Installing -- do not interrupt ...
/opt/puppetlabs/puppet/modules
└── puppetlabs-vcsrepo (v0.0.4)

Install straight from a release archive (iconic behavior honestly):

$ puppet module install puppetlabs-vcsrepo-0.0.4.tar.gz
Preparing to install into /etc/puppet/code/modules ...
Downloading from https://forgeapi.puppet.com ...
Installing -- do not interrupt ...
/etc/puppetlabs/code/modules
└── puppetlabs-vcsrepo (v0.0.4)

Same thing but you're a lone wolf and you ignore dependencies entirely:

$ puppet module install puppetlabs-vcsrepo-0.0.4.tar.gz --ignore-dependencies
Preparing to install into /etc/puppet/code/modules ...
Installing -- do not interrupt ...
/etc/puppetlabs/code/modules
└── puppetlabs-vcsrepo (v0.0.4)

✨ list ✨

See everything that's installed:

$ puppet module list
/etc/puppet/code/modules
β”œβ”€β”€ bodepd-create_resources (v0.0.1)
β”œβ”€β”€ puppetlabs-bacula (v0.0.2)
β”œβ”€β”€ puppetlabs-mysql (v0.0.1)
β”œβ”€β”€ puppetlabs-sqlite (v0.0.1)
└── puppetlabs-stdlib (v2.2.1)
/usr/share/puppet/modules (no modules installed)

Same list but make it a tree, because aesthetics 🌸

$ puppet module list --tree
/etc/puppet/code/modules
└─┬ puppetlabs-bacula (v0.0.2)
  β”œβ”€β”€ puppetlabs-stdlib (v2.2.1)
  β”œβ”€β”¬ puppetlabs-mysql (v0.0.1)
  β”‚ └── bodepd-create_resources (v0.0.1)
  └── puppetlabs-sqlite (v0.0.1)
/usr/share/puppet/modules (no modules installed)

List what's installed in a specific environment:

$ puppet module list --environment production
/etc/puppet/code/modules
β”œβ”€β”€ bodepd-create_resources (v0.0.1)
β”œβ”€β”€ puppetlabs-bacula (v0.0.2)
β”œβ”€β”€ puppetlabs-mysql (v0.0.1)
β”œβ”€β”€ puppetlabs-sqlite (v0.0.1)
└── puppetlabs-stdlib (v2.2.1)
/usr/share/puppet/modules (no modules installed)

List from a specific modulepath:

$ puppet module list --modulepath /usr/share/puppet/modules
/opt/puppetlabs/puppet/modules (no modules installed)

✨ uninstall ✨

Yeet a module:

$ puppet module uninstall puppetlabs-ssh
Removed /etc/puppet/code/modules/ssh (v1.0.0)

Yeet it from a specific directory:

$ puppet module uninstall puppetlabs-ssh --modulepath /usr/share/puppet/modules
Removed /opt/puppetlabs/puppet/modules/ssh (v1.0.0)

Yeet it from a specific environment:

$ puppet module uninstall puppetlabs-ssh --environment development
Removed /etc/puppet/code/environments/development/modules/ssh (v1.0.0)

Yeet one very specific version:

$ puppet module uninstall puppetlabs-ssh --version 2.0.0
Removed /etc/puppet/code/modules/ssh (v2.0.0)

✨ upgrade ✨

Glow up an installed module to the latest version:

$ puppet module upgrade puppetlabs-apache
/etc/puppet/modules
└── puppetlabs-apache (v1.0.0 -> v2.4.0)

Glow up to one specific version:

$ puppet module upgrade puppetlabs-apache --version 2.1.0
/etc/puppet/modules
└── puppetlabs-apache (v1.0.0 -> v2.1.0)

Glow up a module inside a specific environment:

$ puppet module upgrade puppetlabs-apache --environment test
/etc/puppet/code/environments/test/modules
└── puppetlabs-apache (v1.0.0 -> v2.4.0)

Copyright 2012 by Puppet Inc. Apache 2 license; see COPYING


and that's the whole page bestie, you ate πŸ’–βœ¨

This one's brought to you by Puppet, Inc., dated September 2024, and it lives at PUPPET-MODULE(8) in the manual β€” go forth and manage your modules, you absolute icon πŸ«ΆπŸ’…

πŸ“¦ where this page comes from