有没有办法在某些清单中使用hiera定义的变量?
这是我尝试的方式:
manifest.pp
some_config:
server:
foo:
bar: "%{::primary_interface}"
hiera.yaml
dataService.playerList.indexOf()
答案 0 :(得分:3)
是的,possible。看一下这个例子:
<强> test.pp 强>
class nodes::test
{
$value1 = 'abc'
$value2 = hiera('test::value2')
$value3 = hiera('test::value3')
notify{ " v1 ${value1}": }
notify{ " v2 ${value2}": }
notify{ " v3 ${value3}": }
}
include nodes::test
<强> test.yaml 强>
test::value2: "%{value1}"
test::value3: "%{value4}"
运行测试:
puppet apply test.pp
注意:v1 abc
注意:v2 abc
注意:v3
请记住,在hiera中使用puppet变量是really bad practice。