Puppet Forge Modules You Should Know: stdlib, concat, apt, firewall, Archive and More

Puppet Training Course 20 min min read Updated: Nov 17, 2026 Intermediate
Puppet Forge Modules You Should Know: stdlib, concat, apt, firewall, Archive and More
Intermediate Topic 3 of 3

What Is the Forge?

The Puppet Forge (forge.puppet.com) is the public site for sharing modules. A module on the Forge is a ready-made component, such as 'manage Apache' or 'manage PostgreSQL'. Using a good module saves weeks of work and gives you code that others test.

Choosing a Good Module

CheckWhy
Maintainer and badgesLook for Supported, Approved or Partner labels, or a well-known community maintainer such as Vox Pupuli
Last release dateOld modules may break on new Puppet or OS versions
Operating system supportThe metadata lists tested OS versions
Puppet version rangeCheck requirements for your Puppet version (8.x)
Open issues and pull requestsShow how alive the project is
README quality and examplesA good module documents every parameter
DependenciesFewer dependencies mean fewer surprises
LicenceMake sure it fits your company
Modules after the change in Puppet's licence: Many community modules moved to the Vox Pupuli organisation (voxpupuli on GitHub, published as puppet/... on the Forge). Modules by puppetlabs are still published too. Always check the current owner and README.

Install a Module

bash puppet module search firewall puppet module install puppetlabs-stdlib --version 9.6.0 puppet module list puppet module upgrade puppetlabs-stdlib puppet module uninstall puppetlabs-stdlib

In real projects you do not run puppet module install on servers. You list modules in a Puppetfile and let r10k or Code Manager deploy them (see the Modules lessons).

puppetlabs-stdlib: The Standard Library

stdlib is a must-have. It adds many functions, data types and the file_line resource. Most other modules depend on it.

puppet # Data types Stdlib::Port $listen Stdlib::Absolutepath $dir Stdlib::IP::Address::V4 $ip Stdlib::Fqdn $hostname Stdlib::HTTPUrl $url Stdlib::Compat::String $legacy # Functions $items = ['b', 'a', 'a'] notice(unique($items)) # [b, a] notice(delete($items, 'b')) # [a, a] notice(pick($undefined, 'fallback')) # first non-empty value notice(ensure_packages(['git', 'curl'])) # install if not already declared notice(stdlib::to_json({ 'a' => 1 })) notice(stdlib::to_yaml({ 'a' => [1, 2] })) notice(dig($facts, 'os', 'family')) # Resources file_line { 'ssh-banner': path => '/etc/ssh/sshd_config', line => 'Banner /etc/issue.net', match => '^#?Banner', }
ensure_packages: Use ensure_packages(['git']) instead of package { 'git': } in modules. If two classes both ask for git, there is no duplicate declaration error.

puppetlabs-concat: Build a File from Pieces

puppet concat { '/etc/app/servers.conf': owner => 'root', mode => '0644', } concat::fragment { 'header': target => '/etc/app/servers.conf', content => "# Managed by Puppet\n", order => '01', } concat::fragment { 'web1': target => '/etc/app/servers.conf', content => "server web1 10.0.0.1\n", order => '10', } concat::fragment { 'web2': target => '/etc/app/servers.conf', content => "server web2 10.0.0.2\n", order => '10', }

Many modules (for example, HAProxy) use concat so different classes can add their own lines to one file.

puppetlabs-apt and Repositories

puppet include apt apt::source { 'docker': location => 'https://download.docker.com/linux/ubuntu', release => $facts['os']['distro']['codename'], repos => 'stable', key => { 'name' => 'docker.asc', 'source' => 'https://download.docker.com/linux/ubuntu/gpg', }, } package { 'docker-ce': ensure => installed, require => Class['apt::update'], # make sure apt-get update has run }

On Red Hat family systems, use the built-in yumrepo type, or the puppet-yum module for helpers.

puppet-archive: Download and Extract

puppet archive { '/tmp/node_exporter.tar.gz': ensure => present, source => 'https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz', checksum => 'REPLACE_WITH_REAL_SHA256', checksum_type => 'sha256', extract => true, extract_path => '/opt', creates => '/opt/node_exporter-1.8.2.linux-amd64', cleanup => true, }

Other Commonly Used Modules

ModuleUse it for
puppetlabs-firewalliptables/nftables rules as resources (firewall { '100 allow http': dport => 80, proto => tcp, jump => accept })
puppet-firewalld or puppet-nftablesModern firewall management
puppetlabs-vcsrepoClone Git repositories to a path (vcsrepo { '/opt/app': provider => git, source => '...', revision => 'v1.2' })
puppet-systemdUnit files, drop-ins and timers
puppetlabs-dockerDocker engine, images, containers
puppetlabs-postgresql, puppetlabs-mysqlDatabase servers, users, grants
puppetlabs-apache, puppet-nginxWeb servers and virtual hosts
puppetlabs-ntp or puppet-chronyTime sync
puppet-logrotate, puppet-cronLog rotation and cron helpers
puppetlabs-accountsUsers and groups from a hash
puppet-prometheus, puppet-grafanaMonitoring stack
puppetlabs-powershell, puppetlabs-registry, puppetlabs-dsc_liteWindows management
puppet-selinuxSELinux modes, booleans, ports
puppetlabs-translate, puppetlabs-inifileEdit INI-style files (ini_setting)
puppet ini_setting { 'max connections': ensure => present, path => '/etc/app/app.ini', section => 'server', setting => 'max_connections', value => '200', } class { 'nginx': manage_repo => true, } nginx::resource::server { 'shop.example.com': listen_port => 80, proxy => 'http://127.0.0.1:8080', }

Learning a Module Quickly

  • Read the README top to bottom, especially the Usage and Reference sections
  • Look at REFERENCE.md for every class, parameter and default
  • Read manifests/init.pp to see what the main class does
  • Look at data/ and hiera.yaml of the module for defaults per OS
  • Try the module in a throwaway VM with puppet apply first

Wrap Modules in Your Own Profiles

Do not scatter calls to Forge modules all over your code. Wrap them in a profile class (see the roles and profiles lesson). That gives you one place to change behaviour and keeps your data in Hiera.

puppet class profile::web { include nginx # data from Hiera: nginx::... nginx::resource::server { 'default': www_root => '/var/www/html', } }

Practice Tasks

  1. Search the Forge for a module for HAProxy and check its badges, last release and supported OS list
  2. Install puppetlabs-stdlib and use ensure_packages and file_line in a manifest
  3. Use concat to build /etc/hosts.extra from three fragments
  4. Write a manifest using archive to download and extract any small tarball
  5. Open a module's REFERENCE.md and list the parameters of its main class

Conclusion

Reuse before you write. Pick modules with a clear maintainer, recent releases and OS support, pin versions in a Puppetfile, and wrap them inside your own profile classes.

Quick Summary: stdlib everywhere; concat for fragments; apt/yumrepo; archive; check maintainer, date, OS support; wrap in profiles.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators