Forge Home

concat

Construct files from multiple fragments.

87,171,019 downloads

10,698 latest version

4.7 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

  • 9.0.2 (latest)
  • 9.0.1
  • 9.0.0
  • 8.0.1
  • 8.0.0
  • 7.4.0
  • 7.3.3
  • 7.3.2
  • 7.3.1
  • 7.3.0
  • 7.2.0
  • 7.1.1
  • 7.1.0
  • 7.0.2
  • 7.0.1
  • 7.0.0
  • 6.4.0
  • 6.3.0
  • 6.2.0
  • 6.1.0
  • 6.0.0
  • 5.3.0
  • 5.2.0
  • 5.1.0
  • 5.0.0
  • 4.2.1
  • 4.2.0
  • 4.1.1
  • 4.1.0
  • 4.0.1
  • 4.0.0
  • 3.0.0
  • 2.2.1
  • 2.2.0
  • 2.1.0
  • 2.0.1 (deleted)
  • 2.0.0 (deleted)
  • 1.2.5
  • 1.2.4
  • 1.2.3
  • 1.2.2
  • 1.2.1
  • 1.2.0
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.1.0-rc1 (pre-release)
  • 1.0.4
  • 1.0.3
  • 1.0.2
  • 1.0.1
  • 1.0.0
  • 1.0.0-rc1 (pre-release)
released Jan 17th 2024
This version is compatible with:
  • Puppet Enterprise 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
  • Puppet >= 7.0.0 < 9.0.0
  • , , , , , , , , , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'puppetlabs-concat', '9.0.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppetlabs-concat
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppetlabs-concat --version 9.0.2

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

puppetlabs/concat — version 9.0.2 Jan 17th 2024

Reference

Table of Contents

Defined types

  • concat: Manages a file, compiled from one or more text fragments.
  • concat::fragment: Manages a fragment of text to be compiled into a file.

Resource types

Defined types

concat

Manages a file, compiled from one or more text fragments.

Examples

concat { '/tmp/concat':
  ensure => present,
  owner  => 'root',
  group  => 'root',
  mode   => '0644',
}

Parameters

The following parameters are available in the concat defined type:

backup

Data type: Variant[Boolean, String]

Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's native file resource for execution. Valid options: true, false, or a string representing either a target filebucket or a filename extension beginning with ".".

Default value: 'puppet'

ensure

Data type: Enum['present', 'absent']

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.

Default value: 'present'

ensure_newline

Data type: Boolean

Specifies whether to add a line break at the end of each fragment that doesn't already end in one.

Default value: false

format

Data type: Enum['plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty']

Specify what data type to merge the fragments as. Valid options: 'plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'.

Default value: 'plain'

force

Data type: Boolean

Specifies whether to merge data structures, keeping the values with higher order. Used when format is specified as a value other than 'plain'.

Default value: false

group

Data type: Optional[Variant[String, Integer]]

Specifies a permissions group for the destination file. Valid options: a string containing a group name or integer containing a gid.

Default value: undef

mode

Data type: String

Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation.

Default value: '0644'

order

Data type: Enum['alpha','numeric']

Specifies a method for sorting your fragments by name within the destination file. You can override this setting for individual fragments by adjusting the order parameter in their concat::fragment declarations.

Default value: 'alpha'

owner

Data type: Optional[Variant[String, Integer]]

Specifies the owner of the destination file. Valid options: a string containing a username or integer containing a uid.

Default value: undef

path

Data type: Stdlib::Absolutepath

Specifies a destination file for the combined fragments.

Default value: $name

replace

Data type: Boolean

Specifies whether to overwrite the destination file if it already exists.

Default value: true

selinux_ignore_defaults

Data type: Optional[Boolean]

See the file type's selinux_ignore_defaults documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selinux_ignore_defaults

Default value: undef

selrange

Data type: Optional[String]

See the file type's selrange documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrange

Default value: undef

selrole

Data type: Optional[String]

See the file type's selrole documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrole

Default value: undef

seltype

Data type: Optional[String]

See the file type's seltype documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seltype

Default value: undef

seluser

Data type: Optional[String]

See the file type's seluser documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seluser

Default value: undef

show_diff

Data type: Boolean

Specifies whether to set the show_diff parameter for the file resource. Useful for hiding secrets stored in hiera from insecure reporting methods.

Default value: true

validate_cmd

Data type: Optional[String]

Specifies a validation command to apply to the destination file.

Default value: undef

warn

Data type: Variant[Boolean, String]

Specifies whether to add a header message at the top of the destination file. Valid options: the booleans true and false, or a string to serve as the header. If you set 'warn' to true, concat adds the following line with an order of 0: # This file is managed by Puppet. DO NOT EDIT. Before 2.0.0, this parameter would add a newline at the end of the warn message. To improve flexibilty, this was removed. Please add it explicitly if you need it.

Default value: false

create_empty_file

Data type: Boolean

Specifies whether to create an empty file if no fragments are defined. Defaults to true.

Default value: true

concat::fragment

Manages a fragment of text to be compiled into a file.

Parameters

The following parameters are available in the concat::fragment defined type:

content

Data type: Optional[Variant[Sensitive[String], String, Deferred]]

Supplies the content of the fragment. Note: You must supply either a content parameter or a source parameter. Allows a String or a Deferred function which returns a String.

Default value: undef

order

Data type: Variant[String, Integer]

Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. The string option is recommended.

Default value: '10'

source

Data type: Optional[Variant[String, Array]]

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: undef

target

Data type: String

Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat resource.

Resource types

concat_file

Generates a file with content from fragments sharing a common unique tag.

Examples

Concat_fragment <<| tag == 'unique_tag' |>>

concat_file { '/tmp/file':
  tag            => 'unique_tag', # Optional. Default to undef
  path           => '/tmp/file',  # Optional. If given it overrides the resource name
  owner          => 'root',       # Optional. Default to undef
  group          => 'root',       # Optional. Default to undef
  mode           => '0644'        # Optional. Default to undef
  order          => 'numeric'     # Optional, Default to 'numeric'
  ensure_newline => false         # Optional, Defaults to false
}

Properties

The following properties are available in the concat_file type.

ensure

Valid values: present, absent

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.

Default value: present

Parameters

The following parameters are available in the concat_file type.

backup

Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's native file resource for execution. Valid options: true, false, or a string representing either a target filebucket or a filename extension beginning with ".".'

create_empty_file

Valid values: true, false, yes, no

Specifies whether to create an empty file if no fragments are defined.

Default value: true

ensure_newline

Valid values: true, false, yes, no

Specifies whether to add a line break at the end of each fragment that doesn't already end in one.

Default value: false

force

Valid values: true, false, yes, no

Specifies whether to merge data structures, keeping the values with higher order.

Default value: false

format

Valid values: plain, yaml, json, json-array, json-pretty, json-array-pretty

Specify what data type to merge the fragments as. Valid options: 'plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'.

Default value: plain

group

Specifies a permissions group for the destination file. Valid options: a string containing a group name or integer containing a gid.

mode

Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation.

order

Valid values: alpha, numeric

Specifies a method for sorting your fragments by name within the destination file. You can override this setting for individual fragments by adjusting the order parameter in their concat::fragment declarations.

Default value: numeric

owner

Specifies the owner of the destination file. Valid options: a string containing a username or integer containing a uid.

path

Specifies a destination file for the combined fragments. Valid options: a string containing an absolute path. Default value: the title of your declared resource.

replace

Valid values: true, false, yes, no

Specifies whether to overwrite the destination file if it already exists.

Default value: true

selinux_ignore_defaults

Valid values: true, false, yes, no

See the file type's selinux_ignore_defaults documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selinux_ignore_defaults.

selrange

See the file type's selrange documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrange

selrole

See the file type's selrole documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrole

seltype

See the file type's seltype documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seltype

seluser

See the file type's seluser documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seluser

show_diff

Valid values: true, false, yes, no

Specifies whether to set the show_diff parameter for the file resource. Useful for hiding secrets stored in hiera from insecure reporting methods.

tag

Required. Specifies a unique tag reference to collect all concat_fragments with the same tag.

validate_cmd

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.

concat_fragment

Manages the fragment.

Examples

# The example is based on exported resources.

concat_fragment { "uniqe_name_${::fqdn}":
  tag => 'unique_name',
  order => 10, # Optional. Default to 10
  content => 'some content' # OR
  # content => template('template.erb')
  source  => 'puppet:///path/to/file'
}

Parameters

The following parameters are available in the concat_fragment type.

content

Supplies the content of the fragment. Note: You must supply either a content parameter or a source parameter. Valid options: a string

name

namevar

Name of resource.

order

Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. The string option is recommended.

Default value: 10

source

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.

tag

Specifies a unique tag to be used by concat_file to reference and collect content.

target

Required. Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat_file resource.