我正在运行一个以下列方式应用木偶变化的无主傀儡设置。
puppet apply /tmp/puppet/manifests/site.pp --modulepath=/tmp/puppet/modules --hiera_config=/tmp/puppet/hiera.yaml
我一直试图在hiera中处理我们拥有的不同types的节点,并且作为一个起点已经尝试使用在节点上设置的自定义事实。 这个事实是nodetype,在这个例子中被设置为无盘的值。
节点上的Facter认识到这一点。
# facter -y | grep nodetype nodetype: diskless
hiera.yaml包含以下内容
--- :backends: - yaml :yaml: :datadir: /tmp/puppet/data :hierarchy: - node/%{::nodetype}
在/tmp/puppet/data/node/diskless.yaml有
--- cluster: blues
虽然这样做后,我试图仔细检查,然后hiera然后根据需要设置variables,但似乎并没有工作。
hiera -y diskless.yaml cluster nil
有没有更好的方法来debugging问题。 我相信这是简单的,但是如果hiera没有(或不能)在这个用例中运行,那将是令人失望的。
干杯
编辑1:
额外的debugging
hiera cluster '::nodetype=diskless' -d DEBUG: Fri Oct 31 16:54:01 -0400 2014: Hiera YAML backend starting DEBUG: Fri Oct 31 16:54:01 -0400 2014: Looking up cluster in YAML backend DEBUG: Fri Oct 31 16:54:01 -0400 2014: Looking for data source defaults DEBUG: Fri Oct 31 16:54:01 -0400 2014: Cannot find datafile /var/lib/hiera/defaults.yaml, skipping DEBUG: Fri Oct 31 16:54:01 -0400 2014: Looking for data source global DEBUG: Fri Oct 31 16:54:01 -0400 2014: Cannot find datafile /var/lib/hiera/global.yaml, skipping nil
编辑2:
看来设置标志–hiera-config什么都不做,需要将/etc/hiera.yaml链接到希望使用的hiera.yamlconfiguration。
编辑3:在将/etc/hiera.yaml链接到/tmp/puppet/hiera.yaml之后,我能够查找hieravariables,但是无法以预期的方式在木偶清单中使用它们。 相反,我不得不直接打电话给hiera
$networking_config = hiera('networking::network::networking_config','no')
非常混乱
尝试这个:
hiera cluster':: nodetype = diskless'
请参阅: https : //docs.puppetlabs.com/hiera/1/command_line.html#fact-sources