Facts and built-in variables
Before requesting a catalog for a managed node, or
compiling one with puppet apply
, Puppet collects system information, called facts, by using the Facter tool. The
facts are assigned as values to variables that you can use anywhere in your manifests. Puppet also sets some additional special variables, called
built-in variables, which behave a lot like facts.
-
Core facts from Facter.
-
Custom facts and external facts that are present in your modules.
facter -p
on the command line, or browse facts on node detail pages in
the Puppet Enterprise console. You can also use the PuppetDB
API to explore or build tools to search and report on your
infrastructure's facts. Puppet honors fact values of of any data type. It does not convert Boolean, numeric, or structured facts to strings.
-
Accessing facts from Puppet code
When you write Puppet code, you can access facts with the$facts['fact_name']
hash. -
Built-in variables
In addition to Facter's core facts and custom facts, Puppet creates several variables for a node to facilitate managing it. These variables are called trusted facts, server facts, agent facts, server variables, and compiler variables.