How to access variables in an erb-subtemplate in puppet?
Posted
by
c33s
on Server Fault
See other posts from Server Fault
or by c33s
Published on 2012-11-20T21:57:20Z
Indexed on
2012/11/20
23:03 UTC
Read the original article
Hit count: 244
puppet
example.pp
$foo = 'bar'
$content = template('mymodule/maintemplate.erb')
maintemplate.erb
<% bar = foo + "extra" %>
foobar = scope_function_template(['mymodule/subtemplate.erb'])
subtemplate.erb
<%# here i want to access the variable bar %>
<%= bar %>
there is the function
<%= scope.lookupvar('::bar') %>
is there a kind of parent::bar
in erb templateing, or can i pass some variables to the subtemplate, or can i only access the outer variable (of the .pp file) with ::foo
© Server Fault or respective owner