1

I'd like to use template() to concatenate some files. I read this question, which is fine if you know exactly how many files you want to concat. What if I just have an array of input file names?

$files = ['mymod/a.erb', 'mymod/b.erb', 'mymod/c.erb']

file { "/var/foo/final":
  content => template ($files)  # <-- error, can't convert Array to String
}

I'd like to avoid having to write a parser function.

Coderer
  • 113

1 Answers1

3

This is not possible at the moment. There was a Puppet issue submitted for it and a fix proposed but does not seem like there's any rush to implement it.

As a possible workaround, you could have one template include others:

<% @template_array.each do |val| -%>
<% scope.function_template(val) %>
<% end -%>

Forewarning, I have not tested this but I believe it should work.

Belmin Fernandez
  • 11,039
  • 28
  • 89
  • 150