The simplest approach would be a define:
define templated_sample() {
file { "/var/sample/${name}":
content => template("sample/${name}");
}
}
and use an array:
templated_sample{["file1","file2","dir/file3"]:}
Since functions are evaluated on the server, you can create the array
programatically from the list of templates:
$files = split("\0", generate("find", "/var/lib/puppet/files/sample",
"-type", "f", "-print0"))
You'd need another define+array for the directories. But that's just
more of the same...
Regards, DavidS