[Puppet]epp模板中的环境变量

[Puppet]Environment variable in epp template

我会尝试在 epp 模板中使用 $server_facts['environment'],但他无法正常工作。 我的 epp 代码:

<% if $::facts[environment] == 'production' { -%>
# this is production server
<% } else { -%>
# this is NOT production server
<% } -%>

代码 运行 没有错误,但总是使用 else 之后的部分。请帮助修复它。

使用后一切正常$::facts[agent_specified_environment]:

<% if $::facts[agent_specified_environment] == 'production' { -%>
# this is production server
<% } else { -%>
# this is NOT production server
<% } -%>