Adding custom facts to Facter
Sometimes you need to be able to write conditional expressions based on site-specific data that just isn’t available via Facter , or perhaps you’d like to include it in a template.
Because you can’t include arbitrary Ruby code in your manifests, the best solution is to add a new fact to Facter . These additional facts can then be distributed to Puppet clients and are available for use in manifests and templates, just like any other fact is.
lib/facter/util
fails
with an error.Structured and flat facts
A typical fact extracts a piece of information about a system and returns it as either as a simple value (“flat” fact) or data organized as a hash or array (“structured” fact). There are several types of facts classified by how they collect information, including:
-
Core facts, which are built into Facter and are common to almost all systems.
-
Custom facts, which run Ruby code to produce a value.
-
External facts, which return values from pre-defined static data, or the result of an executable script or program.
All fact types can produce flat or structured values.
Related information