Hiera +木偶类

我试图找出Puppet(3.0)以及它与内置Hiera的关系。 所以这就是我尝试的一个非常简单的例子(当我设法让简单的一个工作的时候,我会做一个更复杂的层次):

# /etc/puppet/hiera.yaml :backends: - yaml :hierarchy: - common :yaml: :datadir: /etc/puppet/hieradata # /etc/puppet/hieradata/common.yaml test::param: value # /etc/puppet/modules/test/manifests/init.pp class test ($param) { notice($param) } # /etc/puppet/manifests/site.pp include test 

如果我直接应用它,那很好:

 $ puppet apply /etc/puppet/manifests/site.pp Scope(Class[Test]): value 

如果我经过木偶大师,这不是很好:

 $ puppet agent --test Could not retrieve catalog from remote server: Error 400 on SERVER: Must pass param to Class[Test] at /etc/puppet/manifests/site.pp:1 on node <nodename> 

我错过了什么?

编辑

我刚离开办公室,但有一个想法让我感到震惊:我应该重新启动木偶大师,以便能够看到新的hiera.conf。 我会在星期一尝试 在此期间,如果有人发现一些不是问题的话,我会很感激:)

我是一个白痴,在问题中的编辑是正确的:重新启动木偶大师后,一切正常。

对于Hiera(/etc/puppet/environments/local/hieradata/hostgroups/base/yourhostname/all.yaml)


mySuperVariable:lalala

对于Init (/ etc / puppet / environments / local / manifests / yourhostname / manifest)

mimir :: init {$ myvariable = hiera('mySuperVariable','fallbackValue')}

对于模板 (/ etc / puppet / environments / local / manifest / yourhostname /模板)

无论什么… <%= myvariable%> blahblah