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.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: