FACTER(8)

πŸ“¦
version 4.10.0 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… FACTER β€” okay bestie, let's get you acquainted

so this is the manual page for facter, from the Facter manual, and honestly? it's a banger. let's go πŸŽ€


✨ NAME ✨

facter β€” collect and display facts about the current system πŸ¦‹


🌸 SYNOPSIS 🌸

facter [options] [query] [query] [...]

πŸ’– DESCRIPTION πŸ’–

okay so facter is a command-line tool that gathers basic facts about nodes (aka systems, aka the machine you're on rn) β€” think hardware details, network settings, OS type and version, and more. it's giving full dossier on your computer ✨

these facts get made available as variables in your Puppet manifests, and you can use them to inform conditional expressions in Puppet. iykyk πŸ’…

if you don't give it any queries? it just returns all the facts. every single one. no cap.

also β€” a bunch of the command line options can be set via the HOCON config file instead. that same file can also be used to block or cache certain fact groups. versatile queen πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

  • --color β€” turn color output ON 🌈
  • --no-color β€” turn color output OFF πŸ™ˆ
  • -c, --config β€” where the config file lives
  • --custom-dir β€” a directory to use for custom facts
  • -d, --debug β€” enable debug output
  • --external-dir β€” a directory to use for external facts
  • --hocon β€” output in Hocon format
  • -j, --json β€” output in JSON format
  • -l, --log-level β€” set the logging level. the supported levels are: none, trace, debug, info, warn, error, and fatal
  • --no-block β€” disable fact blocking
  • --no-cache β€” disable loading and refreshing facts from the cache
  • --no-custom-facts β€” disable custom facts
  • --no-external-facts β€” disable external facts
  • --no-ruby β€” disable loading Ruby, facts requiring Ruby, and custom facts
  • --trace β€” enable backtraces for custom facts
  • --verbose β€” enable verbose (info) output
  • --show-legacy β€” show legacy facts when querying all facts
  • -y, --yaml β€” output in YAML format
  • --strict β€” enable more aggressive error reporting πŸ‘€
  • -t, --timing β€” show how much time it took to resolve each fact ⏱️
  • --sequential β€” resolve facts sequentially
  • --http-debug β€” whether to write HTTP request and responses to stderr
🚨 bestie listen. --http-debug should never be used in production. like, never ever. periodt.
  • -p, --puppet β€” load the Puppet libraries, which lets Facter load Puppet-specific facts
  • --version, -v β€” print the version
  • --list-block-groups β€” list block groups
  • --list-cache-groups β€” list cache groups
  • --help, -h β€” help for all arguments 🫢

πŸ“ FILES πŸ“

/etc/facter/facter.conf

a HOCON config file, and she does a LOT: specify directories for custom and external facts, set various command line options, and specify facts to block. see the example below for details, or visit the GitHub README:

https://github.com/puppetlabs/puppetlabs-hocon#overview

🌈 EXAMPLES 🌈

display all facts

$ facter
disks => {
  sda => {
    model => "Virtual disk",
    size => "8.00 GiB",
    size_bytes => 8589934592,
    vendor => "ExampleVendor"
  }
}
dmi => {
  bios => {
    release_date => "06/23/2013",
    vendor => "Example Vendor",
    version => "6.00"
  }
}
[...]

display a single structured fact

$ facter processors
{
  count => 2,
  isa => "x86_64",
  models => [
    "Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz",
    "Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz"
  ],
  physicalcount => 2
}

display a single fact nested within a structured fact

$ facter processors.isa
x86_64

display a single legacy fact

quick note bestie: non-structured facts that existed in previous versions of Facter are still available, but they are not displayed by default β€” that's because they're redundant with the newer structured facts. not a bug, just a glow-up πŸ’…

$ facter processorcount
2

format facts as JSON

$ facter --json os.name os.release.major processors.isa
{
  "os.name": "Ubuntu",
  "os.release.major": "14.04",
  "processors.isa": "x86_64"
}

an example config file

# always loaded (CLI and as Ruby module)
global : {
    external-dir : "~/external/facts",
    custom-dir   :  [
       "~/custom/facts",
       "~/custom/facts/more-facts"
    ],
    no-external-facts : false,
    no-custom-facts   : false,
    no-ruby           : false
}
# loaded when running from the command line
cli : {
    debug     : false,
    trace     : true,
    verbose   : false,
    log-level : "info"
}
# always loaded, fact-specific configuration
facts : {
    # for valid blocklist entries, use --list-block-groups
    blocklist : [ "file system", "EC2" ],
    # for valid time-to-live entries, use --list-cache-groups
    ttls : [ { "timezone" : 30 days } ]
}

and that's the whole page, bestie 🫢 this one's from Puppet, Inc., dated March 2024, and it's page FACTER(8) of the Facter manual. go forth and query some facts, you absolute icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from