0

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

matsukan
  • 73
  • 2
  • 9

1 Answers1

1

There looks like there are a few things going on here.

For one thing, is the syntax of that notice function correct? The Puppet Cookbook shows notice with either brackets notice("message") or in Puppet's class syntax notify { "message": }).

Also, inline_epp takes a hash of the parameters used to fill in the EPP. See the Puppet documentation on inline_epp. In your case, that'd be something like inline_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.

Jon
  • 3,573
  • 2
  • 17
  • 24