我创build了一个简单的定制事实:
Facter.add(:hello) do setcode do "Hello, world" end end
把它放在这里(傀儡大师):
/etc/puppet/modules/custom/lib/facter
我正在木偶客户端testing它:
facter hello
什么都看不到
而这个命令的工作(在傀儡客户端):
facter --puppet hello Hello, world
检查是否同步(在puppet客户端上):
puppetd --test --pluginsync info: Retrieving plugin info: Loading facts in /var/lib/puppet/lib/facter/hello.rb info: Caching catalog for host.example.com
它看起来像自定义事实是同步罚款。 我不明白为什么它不能通过facter 。
另外,我怎样才能从傀儡大师那里使用这个新的事实呢? 我需要根据自定义的事实来构build一个简单的条件。
例如,我在site.pp (puppetmaster)中join了:
$string = "$hello" notice("Testing custom fact: $string")
同样,在syslog中, notice函数中没有行。
我研究了很多文档,但仍然无法使其工作。 如果有人可以看看这个问题,我将不胜感激。
谢谢。
configuration:Ubuntu Server 12.04,Puppet 2.7.11,facter 1.6.5
傀儡的自定义事实只能用在木偶游戏中,或者当在游戏中使用--puppet标志。 如果你不这样做,然后将自定义的事实放在某些因素将永远使用的地方 – 详情请看这里 。
编目目录应该存在这个事实; 你可能不logging通知消息。 将其用作条件:
if $hello == "Hello, world" { notify { "found": } }