i try to create two different files with one template, because they only diff by one line.
file
{
"/tmp/bootstrap-raid.sh":
content => template("pxe/bootstrap.sh.erb"),
}
file
{
"/tmp/bootstrap-noraid.sh":
content => template("pxe/bootstrap.sh.erb"),
}
bootstrap.sh.erb:
<% if ??? == "???" %>
-r yes \
<% else %>
-r no \
<% end %>
i can't pass a variable by defining it twice like $raid=yes file{} $raid=no file{}
, so i tried to define the variable inside each file{}
with no effort. then i thought about using the targetfilename inside the template like <% if filename == "/tmp/bootstrap-raid.sh" %>
which is also not possible.
how to work call a template twice with different "parameters"
my target is to not defining and calling an extra function in the manifest file, or making two templates. any ideas?
are there any predefined default variables in a template like the filename of the targetfile, the templatename,...?
edit:
another example would be having two php.ini files like in debian, one for the command line and one for the webserver. i want only to exchange the memory limit. but each server needs both php.ini files.
i am looking for a way to pass a hardcoded parameter to the template file or a way that i can if/then/else
based upon the targetfilename.
of course i know that i am able to create a new define, which i can call twice. but i am looking for an easier way.