Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a simple custom fact:

Facter.add(:hello) do
  setcode do
    "Hello, world"

and put it here (on puppetmaster):


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

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

share|improve this question
up vote 1 down vote accepted

The custom facts from puppet are only used in puppet runs or when you use the --puppet flag on facter. If you're not ok with that, then put the custom facts somewhere that facter will always use - see here for details.

The fact should be present for the catalog compile; you probably aren't logging notice messages. To use it as a condition:

if $hello == "Hello, world" {
  notify { "found": }
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.