Go to main content

Using Puppet to Perform Configuration Management in Oracle® Solaris 11.4

Exit Print View

Updated: October 2019

Gathering Information About a System by Using Facter

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.4.6
hardwareisa => i386
hardwaremodel => i86pc
hostname => myhost
id => root
interfaces => lo0,net0
ipaddress =>
ipaddress6 => ::
ipaddress_lo0 =>
ipaddress_net0 =>
ipaddress_net1 =>
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

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 preceding 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, go to Facter documentation.