On Wednesday, December 4, 2013 12:33:13 PM UTC-6, Fabio Sangiovanni
wrote:>
> hi everyone,
>
> are there any side effects in using only templates in a module, even when
> they have just static content? It would be helpful in having less
> direcories around to look into when dealing with file contents, especially
> when using hiera as storage for ''source'' and
''content'' values for file
> resources. It just seems more tidy to me not to have a mix of static files
> and templates in a module, comsidering that templates can be a
"superset"
> of the former.
>
>
The value of a File resource''s ''content'' property (by
which the templated
output is delivered) is the actual file content, whereas the
''source''
parameter just contains a URL pointing to the desired content. Each format
has both advantages and disadvantages in that area.
Also, templates put far more load on your master for catalog compilation
than the alternative, even when the template is all-static. That will tend
to reduce the catalog-serving capacity of your master, though it may be
partially offset by the time required later to serve up
''source''d Files.
The ''source'' parameter can reference other files available via
the target
node''s filesystem (including network shares); there is no analog for
templates.
Templates do not support ''recursive'' File resources.
The template() function will concatenate the output of multiple templates,
if given, whereas multiple File ''source''s constitute
prioritized
alternatives.
The template() function is not a good choice for binary files.
Overall, I think it would be best to say that although specifying File
''content'', possibly via a template, and specifying a File
''source'' can
ultimately produce the same plain file on the target node,
''content'' +-
template() is *not* a superset of ''source''. Even where the
two have
overlapping applicability, it is not immediately clear to me that a policy
of always choosing ''content'' is wise. I think that as a
module developer,
you should make an informed decision on a case-by-case basis as to which to
use. I do not find the tidiness argument persuasive.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/cbe7cc83-09b5-4063-82ba-dec335e99f3a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.