facter doesn't show custom facts?

94 views
Skip to first unread message

David Karr

unread,
Feb 23, 2016, 1:29:22 PM2/23/16
to Puppet Users
I wouldn't call myself a puppet user yet.  I finished the "learning vm" tutorial, and I'm reading "Puppet 4 Essentials".

In P4E, I read that "facter" and "puppet facts" don't do the same thing.  The book says that the former doesn't support custom facts.  This seems odd to me, although I wonder if it's even true.  The very next page after this statement shows a diagram with "custom facts" coming from "Master" to "Facter", although I suppose the "Facter" in that diagram may not correspond to the "facter" command-line app.

Is it really true that "puppet facts" shows custom facts, but "facter" does not?

Felix Frank

unread,
Feb 23, 2016, 4:28:54 PM2/23/16
to puppet...@googlegroups.com
Hi,

thanks for reading :-)

Traditionally, you had to invoke `facter -p` to receive Puppet's custom
fact from the facter CLI. When we penned the book, PL had just removed
that option in favor of `puppet facts`.

Shortly after, it became clear that the latter does not quite cover all
bases, and `facter -p` was brought back. Oops! Bottom line, unless
you're quite unlucky, you can use either `puppet facts` or the more
convenient `facter -p`.

As for the diagram: Facter in Puppet's context is not *quite* the same
as the CLI, yes. Puppet loads Facter as a library and uses its API
directly. Invoking `facter` from the shell uses the same fact code, but
without the Puppet context.

In other words, Facter *can* stand on its own, but with Puppet, you
mostly call it *through* Puppet. (Or pass the -p flag, so that Facter
loads Puppet's facts vice versa.)

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages