Using EPP templates
EPP templates are a new feature in Puppet 3.5 and newer versions. EPP templates use a syntax similar to ERB templates but are not compiled through Ruby. Two new functions are defined to call EPP templates, epp
, and inline_epp
. These functions are the EPP equivalents of the ERB functions template
and inline_template
, respectively. The main difference with EPP templates is that variables are referenced using the Puppet notation, $variable
instead of @variable
.
How to do it...
Create an EPP template in
~/puppet/epp-test.epp
with the following content:This is <%= $message %>.
Create an
epp.pp
manifest, which uses theepp
andinline_epp
functions:$message = "the message" file {'/tmp/epp-test': content => epp('/home/thomas/puppet/epp-test.epp') } notify {inline_epp('Also prints <%= $message %>'):}
Apply the manifest making sure to use the future parser (the future parser is required for the
epp
andinline_epp
functions to be defined):t@mylaptop ~/puppet $ puppet...