[根@傀儡木偶]#猫/etc/hiera.yamlhiera CLI查找失败但木偶剂-t工作
---
:backends:
- yaml
:yaml:
:datadir: '/etc/puppet/hieradata'
:hierarchy:
- env/%{::environment}/fqdn/%{::fqdn}
- hostgroup/%{::hostgroup1}
- global
[根@傀儡木偶]#猫hieradata/env的的/ dev/FQDN/client00.itw.local.yaml
fruit::a:
- 'DevFQDN-kiwi'
[根@傀儡木偶]#猫环境的/ dev /模块/果/舱单/ init.pp
class fruit(
$a = hiera('fruit::a'),
$b = hiera('fruit::b'),
$c = hiera('fruit::c')
) {
notify { 'foo':
message => "a is: ${a}, b is: ${b}, c is : ${c}",
}
}
水果::一个似乎可熔酚醛树脂VE对client00.itw.local
[[email protected] ~]# puppet agent -t
Warning: Local environment: "production" doesn't match server specified node environment "dev", switching agent to "dev".
Info: Retrieving plugin
Info: Caching catalog for client00.itw.local
Info: Applying configuration version '1411407772'
Notice: a is: DevFQDN-kiwi, b is: HostgroupAll-orange, c is : global-lime-C
精细但CLI hiera不会对木偶大师
[[email protected] puppet]# hiera -d fruit::a ::fqdn=client00.itw.local ::hostgroup1=all
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Hiera YAML backend starting
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Looking up fruit::a in YAML backend
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Looking for data source hostgroup/all
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Looking for data source global
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Found fruit::a in global
["global-lime-A"]
随着mcollective返回正确的值,hiera -d水果::一个-m client00.itw .local,我得到了同样的结果。
感谢您的帮助。
你确定你的hiera.yaml在/ etc下吗?因为通常木偶代理使用/etc/puppet/hiera.yaml而cli使用/etc/hiera.yaml https://docs.puppetlabs.com/hiera/1/configuring.html – Emyl 2014-09-23 16:02:23
是的。我连接两个文件。 – user1141993 2014-09-23 17:08:40