It's possible to use inline_epp's using string variable like this ?
"htaccess": {
"content": [
"<% include stdlib -%>",
"AuthType Basic ",
"AuthUserFile <%= $auth_file %>",
"Require valid-use"
],
"params": {
"auth_name": "Bootstrap content for provisioning",
"auth_file": "file_path"
}
}
and (some.pp):
$htacces = $sub_attrs['htaccess']
$content = $htacces['content']
$data = join($content, "\n")
$auth_file = "sgsdgsdfgsdfg"
notice inline_epp($data)
This is result in the notice line : Invalid EPP: This Name has no effect. A value was produced and then forgotten (one or more preceding expressions may have the wrong form)
Idea is use hiera data to deliver content to epp . Using puppet 5.5.2 and Ubuntu 16.04
There looks like there are a few things going on here.
For one thing, is the syntax of that
noticefunction correct? The Puppet Cookbook showsnoticewith either bracketsnotice("message")or in Puppet's class syntaxnotify { "message": }).Also,
inline_epptakes a hash of the parameters used to fill in the EPP. See the Puppet documentation oninline_epp. In your case, that'd be something likeinline_epp($data, { auth_file => $auth_file }).And lastly, EPP needs a line at the top listing its parameters. In your case it should be something like
<%- | String $auth_file | -%>. See the Puppet documentation on EPP files.