Forge Home


Collect module


9,701 latest version

2.1 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.0.0 (latest)
released Jul 27th 2014

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'webneat-collect', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add webneat-collect
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install webneat-collect --version 1.0.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



webneat/collect — version 1.0.0 Jul 27th 2014


####Table of Contents

  1. Overview
  2. Usage
  3. Todo


This module have been created to do exactly what puppetlabs-concat module does but in more efficient way. That's it, it constructs files from multiple fragments in an ordered way. But doesn't require additional space to save fragments temporary and doesn't depend on any other module.

The main problem I had when using puppetlabs-concat module was the execution time. When I generated 1500 files, every file from 4 or 5 fragments, it takes more then 50 minutes for the catalog to be executed in the agent. So I read the puppetlabs-concat code I said that it creates one file for every fragment and updates the final file every time a fragment is added. Isn't there any more simple way to do it ?

My first try was using some global variable which will hold all fragments and create files only at the end. But it didn't work because puppet doesn't allow changing the values of variables in other scope ! So I finally ended by just declaring resources and then collect them using a template. And it just works fine and finish execution more quickly.


If you wanted a /etc/motd file that listed all the major modules on the machine. And that would be maintained automatically even if you just remove the include lines for other modules you could use code like below, a sample /etc/motd would be:

Local sysadmins can also append to the file by just editing /etc/motd.local their changes will be incorporated into the puppet managed motd.

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

  collect::file { $motd:
    path => $motd

  collect::part{ 'motd_header':
    target  => $motd,
    content => "\nPuppet modules on this server:\n\n",
    order   => 1

  # local users on the machine can append to motd by just creating
  # /etc/motd.local
  collect::part{ 'motd_local':
    target => $motd,
    source => '/etc/motd.local',
    order  => 15

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

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

To use this you'd then do something like:

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

  motd::register{ 'Apache': }


add missing arguments to collect::file ressource trying to make it just like file ressource