facter
Gather system facts
SYNOPSIS
facter [options] [fact1] [fact2] ...
PARAMETERS
-h, --help
Display help information.
-v, --version
Display version information.
-j, --json
Output facts in JSON format.
-y, --yaml
Output facts in YAML format.
-p, --puppet
Load facts from the Puppet configuration.
-t, --trace
Enable trace output.
--external-dir
Specify a directory to load external facts from.
--custom-dir
Specify a directory to load custom facts from.
DESCRIPTION
The `facter` command is a cross-platform system profiling tool that discovers and reports facts about the operating system, hardware, and network configuration of a machine. These facts can be used for automation, configuration management, and reporting. Facter gathers information such as the operating system name and version, kernel version, CPU architecture, amount of RAM, IP addresses, and more. It is commonly used in conjunction with configuration management tools like Puppet to make configuration decisions based on the characteristics of a system. Facter resolves facts by consulting various system files, command-line tools, and APIs, aggregating the information into a structured data format. By default, facter outputs facts in a human-readable format, but it can also output in JSON format for easier parsing by other programs.
CAVEATS
The specific facts available may vary depending on the operating system and available hardware. Some facts may require root privileges to resolve correctly.
FACT PRECEDENCE
Facter resolves facts in a specific order of precedence.
The highest precedence is given to command line input, followed by external facts, custom facts, and finally, core facts.
Important: Understanding this order is crucial when troubleshooting fact resolution issues.
EXTERNAL FACTS
External facts are facts provided by executable scripts or static data files placed in specific directories (specified with `--external-dir`). Facter executes these scripts or reads these files to obtain additional facts about the system.
They provide mechanism to define custom facts without writing Ruby code.
HISTORY
Facter was originally developed as part of the Puppet configuration management system. Its primary purpose was to provide a consistent and reliable way to gather information about systems so that Puppet could make informed configuration decisions. Over time, Facter has evolved into a standalone tool that can be used independently of Puppet. It is written primarily in Ruby but some of the underlying fact resolution is done via c++ using facterlib. It's widely adopted across the DevOps and system administration communities for system inventory and automation tasks.
SEE ALSO
puppet(1), ohai(1)