puppet template ‘heredoc’
January 5, 2012
Using puppet? So sad.
Need to use puppet templates? Even worse.
Have to include a file, verbatim inside the resulting file but you don’t want to put it in your template itself b/c it is too big or cumbersome? Here’s how you do it.
1. put the file in the ‘files’ subdir in the module you’re working on in puppet
2. put this in your template
<%=
fn = Puppet::Module.find("test").file_directory + "/myfile.txt"
File.read(fn)
-%>
then that file will be read from the ‘files’ dir in your module directly into the output from the template.
Advertisement