Skip to content
File concatenation system for Puppet
Ruby Puppet
Branch: master
Clone or download
Pull request Compare This branch is 4 commits behind puppetlabs:master.
DavidS Merge pull request puppetlabs#623 from SimonPe/patch-1
Fix newline handling at the end of fragments
Latest commit 4db881b Jan 6, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode (FM-7709) pdksync and remove beaker Jun 25, 2019
examples (FM-7340) - Add additional example Dec 6, 2018
lib/puppet/type Search for newlines at end of string, not at end of line Jan 3, 2020
locales (L10n) Updating translations for locales/ja/puppetlabs-concat.po Jan 2, 2019
manifests Updated regex to allow for windows paths with \'s Jul 10, 2019
readmes (L10n) Updating translations for readmes/ Jan 2, 2019
spec (maint) Update for PDK templates Oct 31, 2019
.fixtures.yml (FM-8634) ensure encrypted communication for fixtures Nov 1, 2019
.gitattributes (FM-7339) - Add i18n implementation Dec 3, 2018
.gitignore (maint) update gitignore and pdkignore for .project file removal Nov 21, 2019
.pdkignore (maint) update gitignore and pdkignore for .project file removal Nov 21, 2019
.puppet-lint.rc pdksync - (maint) Update pdk-template to f778803 Apr 15, 2019
.rspec (FM-4049) Update to current msync configs [2c99161] Jan 27, 2016
.rubocop.yml (maint) Update for PDK templates Oct 31, 2019
.rubocop_todo.yml Fix rubocop offenses Feb 15, 2019
.sync.yml (maint) update travis to notify puppet slack Dec 16, 2019
.travis.yml (maint) update travis to notify puppet slack Dec 16, 2019
.yardopts pdksync_heads/master-0-g85ca41b May 18, 2018 Release prep v6.1.0 Jul 23, 2019
CODEOWNERS (maint) modulesync 892c4cf Sep 18, 2017
Gemfile (PDK-1501) Allow Appveyor CI config to be templated Nov 7, 2019 (MODULES-7706) - Release Prep for 5.0.0 Aug 24, 2018
NOTICE (maint) modulesync 65530a4 Update Travis Jan 3, 2018 (FM-8391) Update README per team practices Oct 31, 2019 (FM-7341) - Added and updated documentation Nov 29, 2018
Rakefile (maint) Update for PDK templates Oct 31, 2019
appveyor.yml (maint) enable simplecov for ruby codecoverage testing Nov 27, 2019
distelli-manifest.yml (FM-7606) enable litmus for concat May 7, 2019
metadata.json (maint) update travis to not use bundle update --system Dec 16, 2019


Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module


The concat module lets you construct files from multiple ordered fragments of text.

Module Description

The concat module lets you gather concat::fragment resources from your other modules and order them into a coherent file through a single concat resource.

Beginning with concat

To start using concat you need to create:

  • A concat{} resource for the final file.
  • One or more concat::fragment{}s.

A minimal example might be:

concat { '/tmp/file':
  ensure => present,

concat::fragment { 'tmpfile':
  target  => '/tmp/file',
  content => 'test contents',
  order   => '01'


Maintain a list of the major modules on a node

To maintain an motd file that lists the modules on one of your nodes, first create a class to frame up the file:

class motd {
  $motd = '/etc/motd'

  concat { $motd:
    owner => 'root',
    group => 'root',
    mode  => '0644'

  concat::fragment { 'motd_header':
    target  => $motd,
    content => "\nPuppet modules on this server:\n\n",
    order   => '01'

  # let local users add to the motd by creating a file called
  # /etc/motd.local
  concat::fragment { 'motd_local':
    target => $motd,
    source => '/etc/motd.local',
    order  => '15'

# let other modules register themselves in the motd
define motd::register (
  $content = "",
  $order   = '10',
) {
  if $content == "" {
    $body = $name
  } else {
    $body = $content

  concat::fragment { "motd_fragment_$name":
    target  => '/etc/motd',
    order   => $order,
    content => "    -- $body\n"

Then, in the declarations for each module on the node, add motd::register{ 'Apache': } to register the module in the motd.

class apache {
  include apache::install, apache::config, apache::service

  motd::register { 'Apache': }

These two steps populate the /etc/motd file with a list of the installed and registered modules, which stays updated even if you just remove the registered modules' include lines. System administrators can append text to the list by writing to /etc/motd.local.

When you're finished, the motd file will look something like this:

  Puppet modules on this server:

    -- Apache
    -- MySQL

  <contents of /etc/motd.local>



Removed functionality

The following functionality existed in previous versions of the concat module, but was removed in version 2.0.0:

Parameters removed from concat::fragment:

  • gnu
  • backup
  • group
  • mode
  • owner

The concat::setup class has also been removed.

Prior to concat version 2.0.0, if you set the warn parameter to a string value of true, false, 'yes', 'no', 'on', or 'off', the module translated the string to the corresponding boolean value. In concat version 2.0.0 and newer, the warn_header parameter treats those values the same as other strings and uses them as the content of your header message. To avoid that, pass the true and false values as booleans instead of strings.


This module has been tested on all PE-supported platforms, and no issues have been identified.

For an extensive list of supported operating systems, see metadata.json


Acceptance tests for this module leverage puppet_litmus. To run the acceptance tests follow the instructions here. You can also find a tutorial and walkthrough of using Litmus and the PDK on YouTube.

If you run into an issue with this module, or if you would like to request a feature, please file a ticket. Every Monday the Puppet IA Content Team has office hours in the Puppet Community Slack, alternating between an EMEA friendly time (1300 UTC) and an Americas friendly time (0900 Pacific, 1700 UTC).

If you have problems getting this module up and running, please contact Support.

If you submit a change to this module, be sure to regenerate the reference documentation as follows:

puppet strings generate --format markdown --out


Richard Pijnenburg (@Richardp82)

Joshua Hoblitt (@jhoblitt)

More contributors.

You can’t perform that action at this time.