Forge Home

concatfile

UNKNOWN

10,318 downloads

9,717 latest version

1.9 quality score

Version information

  • 0.0.4 (latest)
  • 0.0.2 (deleted)
  • 0.0.1 (deleted)
released Nov 30th 2012

Start using this module

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

Add this module to your Puppetfile:

mod 'anselm-concatfile', '0.0.4'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add anselm-concatfile
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install anselm-concatfile --version 0.0.4

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.

Download

Documentation

anselm/concatfile — version 0.0.4 Nov 30th 2012

puppet-concatfile

Description

A very simple Puppet module that concatenates multiple text parts together to one file. The single parts can be file sources, string content or existing files on the target system.

Dependencies

Usage

First, define the file that should be concatenated from the parts:

The dir parameter specifies in which folder the parts are collected.

Then, define some parts:

The directory in the resource name of each part must match the dir parameter used in the concatfile resource, that is how Puppet knows they are connected. The files will later be sorted numerically and concatenated in that order.

The result is that the file /etc/sysctl.conf is concatenated from the 3 files in /etc/sysctl.conf.d/. Their content comes from 3 different possible sources: a Puppet files resource, a string and a symlink to a local file.

Details

Behavior

Each part is deployed as file in the specified folder. A simple exec command in the form of find ... | sort ... | cat ... > target_file is then used to concatenate all parts together. Apart from the basic update behavior from Puppet when any file is removed/modified, or any definition in the code is added/modified/removed, an update should also be triggered when a alien file is placed in the folder where the parts are stored, and the file gets removed.

Parameters

Possible parameters to concatfile are:

  • dir (required)
  • owner
  • group
  • mode

Possible parameters to concatfile::part are:

  • source
  • content
  • file
  • owner
  • group
  • mode

Only one of source, content or file makes sense and is allowed.

Extending

The defines can easily be wrapped to save some typing or e.g. introduce an order parameter:

Todo

  • Triggering the update when the concatenated file is modified was not tested (did not have a puppet master around, and remembering checksums does not work completely with Puppet in standalone mode).

Written By

Anselm Strauss http://github.com/amsibamsi