You use the Facter utility to gather information about a system. This information is sent to the Puppet master and then used by Puppet's resource providers to compile catalogs that specify the configuration changes that should be applied to each of the nodes.
A catalog also specifies the states in which each of the resources should be. Based on these definitions, each system can then apply its own configurations, as appropriate. After the catalog is applied to the system, the agent generates a report and sends that report to the Puppet master. This report contains information about which resources are currently being managed on the target node, as well as any changes that were made to the node to achieve a desired state. See How Puppet Works.
To list all of the facts that are available for a given node, type the following command:
# facter -p architecture => i86pc facterversion => 2.1.0 hardwareisa => i386 hardwaremodel => i86pc hostname => myhost id => root interfaces => lo0,net0 ipaddress => 203.0.113.15 ipaddress6 => :: ipaddress_lo0 => 127.0.0.1 ipaddress_net0 => 203.0.113.5 ipaddress_net1 => 203.0.113.5 ... uptime => 0:22 hours uptime_days => 0 uptime_hours => 0 uptime_seconds => 1320 virtual => virtualbox
Or, you can display an individual fact for a given node, for example hostname, as follows:
# facter hostname myhost
Gathering facts about a system can assist you in determining the types of configuration that you can enforce on a given system. For example, you could declare a file resource that would populate a given file with platform-specific content.
In the following example, the osfamily fact is used to declare the platform within the file:
$file_contents = $osfamily ? { 'solaris' => "Hello Oracle Solaris", 'redhat' => "Hello RHEL", } file { '/custom-file.txt': ensure => 'present', content => $file_contents, }
In the previous example, a new $file_contents variable was created and a conditional check was provided by using the osfamily fact. Then, depending on the platform, you would assign different contents to the file.
For more information, see Facter: Custom Facts.