【问题标题】:puppet and inline_epp and using hiera deliver contentpuppet 和 inline_epp 以及使用 hiera 传递内容
【发布时间】:2018-07-15 16:40:08
【问题描述】:

可以像这样使用 inline_epp 的字符串变量吗?

                    "htaccess": {
                    "content": [
                        "<% include stdlib -%>",
                        "AuthType Basic ",
                        "AuthUserFile <%= $auth_file %>",
                        "Require valid-use"
                    ],
                    "params": {
                        "auth_name": "Bootstrap content for provisioning",
                        "auth_file": "file_path"
                    }
                }

和(一些.pp):

                $htacces = $sub_attrs['htaccess']
                $content = $htacces['content']
                $data = join($content, "\n")

                $auth_file = "sgsdgsdfgsdfg"

                notice inline_epp($data)

这是通知行中的结果:Invalid EPP: This Name has no 影响。一个值被产生然后被遗忘(一个或多个前面的 表达式可能有错误的形式)

想法是使用 hiera 数据向 epp 提供内容。 使用 puppet 5.5.2 和 Ubuntu 16.04

【问题讨论】:

    标签: puppet epp


    【解决方案1】:

    这里似乎发生了一些事情。

    一方面,notice 函数的语法是否正确? Puppet Cookbook 显示 notice 带有方括号 notice("message") 或 Puppet 的类语法 notify { "message": })。

    此外,inline_epp 采用用于填充 EPP 的参数的哈希值。请参阅Puppet documentation on inline_epp。在你的情况下,这类似于inline_epp($data, { auth_file =&gt; $auth_file })

    最后,EPP 需要在顶部有一行列出其参数。在您的情况下,它应该类似于&lt;%- | String $auth_file | -%&gt;。请参阅Puppet documentation on EPP files

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多