5 1. [Overview](#overview)
6 2. [Module Description - What the module does and why it is useful](#module-description)
7 3. [Setup - The basics of getting started with concat](#setup)
8 * [What concat affects](#what-concat-affects)
9 * [Beginning with concat](#beginning-with-concat)
10 4. [Usage - Configuration options and additional functionality](#usage)
11 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
12 * [Public Defines](#public-defines)
13 * [Parameters](#parameters)
14 * [Deprecations](#deprecations)
15 6. [Limitations - OS compatibility, etc.](#limitations)
16 7. [Development - Guide for contributing to the module](#development)
20 The concat module lets you construct files from multiple ordered fragments of text.
24 The concat module lets you gather `concat::fragment` resources from your other modules and order them through a single `concat` resource into a coherent file. It does this through a Ruby script and a temporary holding space for the fragments.
28 ###What concat affects
30 * Installs `concatfragments.rb`.
31 * Adds a `concat/` directory into Puppet's `vardir`.
33 ###Beginning with concat
35 To start using concat you need to create:
37 * A concat{} resource for the final file.
38 * One or more concat::fragment{}s.
40 A minimal example might be:
47 concat::fragment { 'tmpfile':
48 target => '/tmp/file',
49 content => 'test contents',
56 ###Maintain a list of the major modules on a node
58 To maintain an motd file that lists the modules on one of your nodes, first create a class to frame up the file:
70 concat::fragment{ 'motd_header':
72 content => "\nPuppet modules on this server:\n\n",
76 # let local users add to the motd by creating a file called
78 concat::fragment{ 'motd_local':
80 source => '/etc/motd.local',
85 # let other modules register themselves in the motd
86 define motd::register($content="", $order='10') {
93 concat::fragment{ "motd_fragment_$name":
94 target => '/etc/motd',
96 content => " -- $body\n"
101 Then, in the declarations for each module on the node, add `motd::register{ 'Apache': }` to register the module in the motd.
105 include apache::install, apache::config, apache::service
107 motd::register{ 'Apache': }
111 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.
113 When you're finished, the motd file will look something like this:
116 Puppet modules on this server:
121 <contents of /etc/motd.local>
126 **Note**: Several of this module's parameters and features have been deprecated. See the [Deprecations](#deprecations) section below.
129 * `concat`: Manages a file, compiled from one or more text fragments.
130 * `concat::fragment`: Manages a fragment of text to be compiled into a file.
136 All the parameters listed below are optional.
140 Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's [native `file` resource](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-backup) for execution. Valid options: 'true', 'false', or a string representing either a target filebucket or a filename extension beginning with ".". Default value: 'puppet'.
144 Specifies whether the destination file should exist. Setting to 'absent' tells Puppet to delete the destination file if it exists, and negates the effect of any other parameters. Valid options: 'present' and 'absent'. Default value: 'present'.
147 #####`ensure_newline`
149 Specifies whether to ensure there's a new line at the end of each fragment. Valid options: 'true' and 'false'. Default value: 'false'.
153 In case no fragments have been added, this parameter specifies whether to go ahead and create a potentially empty file. Valid options: 'true' and 'false'. Default value: 'false'.
157 Specifies a permissions group for the destination file. Valid options: a string containing a group name. Default value: undefined.
161 Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation. Default value: '0644'.
165 Specifies a method for sorting your fragments by name within the destination file. Valid options: 'alpha' (e.g., '1, 10, 2') or 'numeric' (e.g., '1, 2, 10'). Default value: 'alpha'.
167 You can override this setting for individual fragments by adjusting the `order` parameter in their `concat::fragment` declarations.
172 Specifies the owner of the destination file. Valid options: a string containing a username. Default value: undefined.
177 Specifies a destination file for the combined fragments. Valid options: a string containing an absolute path. Default value: the title of your declared resource.
181 Specifies whether to overwrite the destination file if it already exists. Valid options: 'true' and 'false'. Default value: 'true'.
185 Specifies a validation command to apply to the destination file. Requires Puppet version 3.5 or newer. Valid options: a string to be passed to a file resource. Default value: undefined.
189 Specifies whether to add a warning message at the top of the destination file so users know it was autogenerated by Puppet. Valid options: 'true', 'false', or a string to be delivered as a warning message. Default value: 'false'.
192 If you set this parameter to 'true', Puppet adds the following message:
195 # This file is managed by Puppet. DO NOT EDIT.
198 ####`concat::fragment`
201 Except where noted, all the below parameters are optional.
205 Supplies the content of the fragment. **Note**: You must supply either a `content` parameter or a `source` parameter. Valid options: a string. Default value: undef.
209 Specifies whether the fragment should be included in the destination file or discarded. Valid options: 'present' and 'absent'. Default value: 'present'.
213 Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. Valid options: a string (recommended) or an integer. Default value: '10'.
217 Specifies a file to read into the content of the fragment. **Note**: You must supply either a `content` parameter or a `source` parameter. Valid options: a string or an array, containing one or more Puppet URLs. Default value: undefined.
221 *Required.* Specifies the destination file of the fragment. Valid options: a string containing an absolute path.
225 **`concat` has the following deprecations**
229 Generates a catalog compile time warning and has no effect. This parameter was silently ignored in version `1.0.0` and will be removed in a future release.
231 #####stringified 'true'/'false' values deprecated in `warn`
233 Passing stringified boolean values (strings of 'true' and 'false') to the `warn` parameter of `concat` is deprecated. Generates a catalog compile time warning, and will be silently treated as the concatenated file header/warning message in a future release.
235 Please migrate to using the Puppet DSL's native [Boolean data
236 type](http://docs.puppetlabs.com/puppet/3/reference/lang_datatypes.html#booleans).
239 **`concat::fragment` has the following deprecations**
243 Generates a catalog compile time warning and has no effect. In the `1.0.0` release this parameter controlled file bucketing of the file fragment. Bucketing the fragment(s) is redundant with bucketing the final concatenated file and this feature has been removed.
248 Generates a catalog compile time warning and has no effect. Had no user-visible effect in version `1.0.0` and will be removed in a future release.
252 Generates a catalog compile time warning and has no effect. Had no user-visible effect in version `1.0.0` and will be removed in a future release.
257 Generates a catalog compile time warning and has no effect. Had no user-visible effect in version `1.0.0` and will be removed in a future release.
259 #####file paths are deprecated in `ensure`
261 Passing a value other than 'present' or 'absent' in the `ensure` parameter of `concat::fragment` is **deprecated**, and generates a catalog compile time warning. The warning will become a catalog compilation failure in a future release.
263 If you want to use the content of a file as a fragment please use the [`source`](#source) parameter.
267 The `concat::setup` class should no longer be directly included in the manifest. It will be removed in a future release.
271 This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified.
275 Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
277 We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
279 For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)
283 To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-concat/graphs/contributors)