Puppet – How to Concatenate Templates

puppettemplates

In the module I'm currently working on, I got a load of configuration options that need to be set, have default values … and should be fragmented into shorter template files as else it would be a scrolling nightmare.

The recommended way to do so was to use some third party modules. Is there no built in way?

Best Answer

Another possible solution that surprisingly works (and about which I couldn't find any documentation), is the array syntax inside the template() function:

file { "${location}/final-file.php":
    ensure  => file,
    content => template(
        'wppuppet/template.a.erb',
        'wppuppet/template.b.erb',
        'wppuppet/template.c.erb'
    ),
}