Get filename for puppet template

Posted by Noodles on Server Fault See other posts from Server Fault or by Noodles
Published on 2012-09-25T02:43:29Z Indexed on 2012/09/25 3:39 UTC
Read the original article Hit count: 240

Filed under:
|
|

I have a file that I'd like to reuse for a few different purposes. The file is 90% the same across uses, just slight differences. I'd rather not replicate the content across multiple files in puppet, so is there a way to do something like

file { "/tmp/file1" :
  content => template("module/template.erb")
}

file { "/tmp/file2" :
  content => template("module/template.erb")
}

And in the template:

Jack
John
James
<% if file == "/tmp/file2" %>
Jim
<% end %>

© Server Fault or respective owner

Related posts about puppet

Related posts about variables