Using multiple sources for Puppet templates

Stephan Koene

I this version I would like to talk about using multiple sources for templates and the function that isn’t often used.

We all know that we can use multiple sources for files:

File {‘⁄etc⁄myfile’:
ensure => present,
source => [“puppet:///modules/${module_name}/${some_var}/possiblesource”,

… and multiple sources for templates:

File {‘⁄etc⁄myotherapp.conf’:
ensure => present,
content => template([“modules/${module_name}/first_half.erb”,

But the problem is that Puppet will concatenate these sources. Although this might be useful / wanted in some cases, we came across a situation where this wasn’t ideal.

Looking for a solution, we found the function (‘multi_source_template’) written by R.I. Pienaar ( which allows the the use of multiple sources for templates in the same way as these are handled by the file resource:

File {‘⁄etc⁄myapp.conf’:
ensure => present,
content => multi_source_template (

Credits: R.I Pienaar (, R. Van Leeuwen (


1 Comment

you might also like