A collection of task oriented solutions in Puppet

 

Show all facter facts

Challenge

You want to see all the facts available to you.

Solution

# show all facter facts
facter

... snip...
kernelversion => 4.10.15
lsbdistcodename => TwentyFive
lsbdistdescription => Fedora release 25 (Twenty Five)
lsbdistid => Fedora
... snip ...
# show all the facts available to puppet
# run this as the user puppet runs under
puppet facts show

{
  "name": "show",
  "values": {
    "puppetversion": "4.2.1",
  ... snip ...
}

Explanation

While facter is heavily used by puppet, it can be run as a standalone program or included as a library in your own ruby code. If invoked with no arguments facter will list the facts and their values it knows about.

In modern versions of puppet and facter the way to view all the facts has changed. In the past you'd run facter -p. This is no longer sufficient and is deprecated. Instead you should use -

# show all the facts available to puppet
# run this as the user puppet runs under
puppet facts show

{
  "name": "show",
  "values": {
    "puppetversion": "4.2.1",
  ... snip ...
}

This newer command will show all the facts puppet knows about, including those provided by modules, in their nested structure.

See also