1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
# concat
#### Table of Contents
1. [Overview](#overview)
2. [Module Description - What the module does and why it is useful](#module-description)
* [Beginning with concat](#beginning-with-concat)
4. [Usage - Configuration options and additional functionality](#usage)
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
* [Removed functionality](#removed-functionality)
6. [Limitations - OS compatibility, etc.](#limitations)
7. [Development - Guide for contributing to the module](#development)
<a id="overview"></a>
## Overview
The concat module lets you construct files from multiple ordered fragments of text.
<a id="module-description"></a>
## 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.
<a id="beginning-with-concat"></a>
### 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'
}
~~~
<a id="usage"></a>
## Usage
### 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>
~~~
<a id="reference"></a>
## Reference
See [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-concat/blob/main/REFERENCE.md)
<a id="removed-functionality"></a>
### 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.
<a id="limitations"></a>
## Limitations
This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified.
For an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-concat/blob/main/metadata.json)
## Development
Acceptance tests for this module leverage [puppet_litmus](https://github.com/puppetlabs/puppet_litmus).
To run the acceptance tests follow the instructions [here](https://github.com/puppetlabs/puppet_litmus/wiki/Tutorial:-use-Litmus-to-execute-acceptance-tests-with-a-sample-module-(MoTD)#install-the-necessary-gems-for-the-module).
You can also find a tutorial and walkthrough of using Litmus and the PDK on [YouTube](https://www.youtube.com/watch?v=FYfR7ZEGHoE).
If you run into an issue with this module, or if you would like to request a feature, please [file a ticket](https://tickets.puppetlabs.com/browse/MODULES/).
Every Monday the Puppet IA Content Team has [office hours](https://puppet.com/community/office-hours) in the [Puppet Community Slack](http://slack.puppet.com/), 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](http://puppetlabs.com/services/customer-support).
If you submit a change to this module, be sure to regenerate the reference documentation as follows:
```bash
puppet strings generate --format markdown --out REFERENCE.md
```
### Contributors
Richard Pijnenburg ([@Richardp82](http://twitter.com/richardp82))
Joshua Hoblitt ([@jhoblitt](http://twitter.com/jhoblitt))
[More contributors](https://github.com/puppetlabs/puppetlabs-concat/graphs/contributors).
|