I created a simple custom fact:
Facter.add(:hello) do
setcode do
"Hello, world"
end
end
and put it here (on puppetmaster):
/etc/puppet/modules/custom/lib/facter
I'm testing it on puppet client:
facter hello
and see nothing.
Whereas this command works (on puppet client):
facter --puppet hello
Hello, world
Checking if the fact is synced (on puppet client):
puppetd --test --pluginsync
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/hello.rb
info: Caching catalog for host.example.com
It looks like the custom fact is synced fine. I can't understand why it's not available via facter
.
Also, how can I use this new fact from puppetmaster? I need to build a simple conditional based on the custom fact.
For example, I added in site.pp
(on puppetmaster):
$string = "$hello"
notice("Testing custom fact: $string")
Again, in syslog there is no line from the notice
function.
I studied a lot of documentation and still can't get how to make it work. I will appreciate if someone could look on this issue.
Thank you.
Configuration: Ubuntu Server 12.04, Puppet 2.7.11, facter 1.6.5