Docs: Facter 1.6: Core Facts


Facter 1.6: Core Facts

Summary

This is a list of all of the built-in facts that ship with Facter 1.6.x. Not all of them apply to every system, and your site may use many custom facts delivered via Puppet modules. To see the actual available facts (including plugins) and their values on any of your systems, run facter -p at the command line. If you are using Puppet Enterprise, you can view all of the facts for any node on the node’s page in the console.

Facts appear in Puppet as normal top-scope variables. This means you can access any fact for a node in your manifests with $<fact name>. (E.g. $osfamily, $memorysize, etc.)

architecture

Returns the CPU hardware architecture.

Resolution:

  • On OpenBSD, Linux and Debian’s kfreebsd, use the hardwaremodel fact.
  • Gentoo and Debian call “x86_64” “amd64”.
  • Gentoo also calls “i386” “x86”.

(↑ Back to top)


arp

Undocumented.

(↑ Back to top)


arp_{NETWORK INTERFACE}

Undocumented.

(↑ Back to top)


augeasversion

Report the version of the Augeas library

Resolution:

Loads ruby-augeas and reports the value of /augeas/version, the version of the underlying Augeas library.

Caveats:

The library version may not indicate the presence of certain lenses, depending on the system packages updated, nor the version of ruby-augeas which may affect support for the Puppet Augeas provider. Versions prior to 0.3.6 cannot be interrogated for their version.

(↑ Back to top)


boardmanufacturer

Returns the manufacturer of the machine’s motherboard.

(↑ Back to top)


boardproductname

Returns the model name of the machine’s motherboard.

(↑ Back to top)


boardserialnumber

Returns the serial number of the machine’s motherboard.

(↑ Back to top)


cfkey

Returns the public key(s) for CFengine.

Resolution:

Tries each file of standard localhost.pub & cfkey.pub locations, checks if they appear to be a public key, and then join them all together.

(↑ Back to top)


domain

Returns the host’s primary DNS domain name.

Resolution:

  • On UNIX (excluding Darwin), first try and use the hostname fact, which uses the hostname system command, and then parse the output of that.
  • Failing that it tries the dnsdomainname system command.
  • Failing that it uses /etc/resolv.conf and takes the domain from that, or as a final resort, the search from that.
  • Otherwise returns nil.
  • On Windows uses the win32ole gem and winmgmts to get the DNSDomain value from the Win32 networking stack.

(↑ Back to top)


ec2_{EC2 INSTANCE DATA}

Returns info retrieved in bulk from the EC2 API. The names of these facts should be self explanatory, and they are otherwise undocumented. The full list of these facts is:

  • ec2_ami_id
  • ec2_ami_launch_index
  • ec2_ami_manifest_path
  • ec2_block_device_mapping_ami
  • ec2_block_device_mapping_ephemeral0
  • ec2_block_device_mapping_root
  • ec2_hostname
  • ec2_instance_id
  • ec2_instance_type
  • ec2_kernel_id
  • ec2_local_hostname
  • ec2_local_ipv4
  • ec2_placement_availability_zone
  • ec2_profile
  • ec2_public_hostname
  • ec2_public_ipv4
  • ec2_public_keys_0_openssh_key
  • ec2_reservation_id
  • ec2_security_groups

(↑ Back to top)


ec2_userdata

Undocumented.

(↑ Back to top)


facterversion

Returns the version of the facter module.

Resolution:

Uses the version constant.

(↑ Back to top)


fqdn

Returns the fully qualified domain name of the host.

Resolution:

Simply joins the hostname fact with the domain name fact.

Caveats:

No attempt is made to check that the two facts are accurate or that the two facts go together. At no point is there any DNS resolution made either.

(↑ Back to top)


hardwareisa

Returns hardware processor type.

Resolution:

On Solaris, Linux and the BSDs simply uses the output of “uname -p”

Caveats:

Some linuxes return unknown to uname -p with relative ease.

(↑ Back to top)


hardwaremodel

Returns the hardware model of the system.

Resolution:

  • Uses purely “uname -m” on all platforms other than AIX and Windows.
  • On AIX uses the parsed “modelname” output of “lsattr -El sys0 -a modelname”.
  • On Windows uses the ‘host_cpu’ pulled out of Ruby’s config.

(↑ Back to top)


hostname

Returns the system’s short hostname.

Resolution:

  • On all system bar Darwin, parses the output of the “hostname” system command to everything before the first period.
  • On Darwin, uses the system configuration util to get the LocalHostName variable.

(↑ Back to top)


id

Internal fact used to specify the program to return the currently running user id.

Resolution:

  • On all Unixes bar Solaris, just returns “whoami”.
  • On Solaris, parses the output of the “id” command to grab the username, as Solaris doesn’t have the whoami command.

(↑ Back to top)


interfaces

Returns a list of the network interfaces on the machine. These interface names are also used to construct several additional facts.

(↑ Back to top)


ipaddress

Returns the main IP address for a host.

Resolution:

  • On the Unixes does an ifconfig, and returns the first non 127.0.0.0/8 subnetted IP it finds.
  • On Windows, it attempts to use the socket library and resolve the machine’s hostname via DNS.
  • On LDAP based hosts it tries to use either the win32/resolv library to resolve the hostname to an IP address, or on Unix, it uses the resolv library.
  • As a fall back for undefined systems, it tries to run the “host” command to resolve the machine’s hostname using the system DNS.

Caveats:

  • DNS resolution relies on working DNS infrastructure and resolvers on the host system.
  • The ifconfig parsing purely takes the first IP address it finds without any checking this is a useful IP address.

(↑ Back to top)


ipaddress_{NETWORK INTERFACE}

Returns the IP4 address for a specific network interface (from the list in the interfaces fact).

(↑ Back to top)


ipaddress6

Returns the “main” IPv6 IP address of a system.

Resolution:

OS-dependent code that parses the output of various networking tools and currently not very intelligent. Returns the first non-loopback and non-linklocal address found in the ouput unless a default route can be mapped to a routeable interface. Guessing an interface is currently only possible with BSD type systems to many assumptions have to be made on other platforms to make this work with the current code. Most code ported or modeled after the ipaddress fact for the sake of similar functionality and familiar mechanics.

(↑ Back to top)


ipaddress6_{NETWORK INTERFACE}

Returns the IP6 address for a specific network interface (from the list in the interfaces fact).

(↑ Back to top)


iphostnumber

On selected versions of Darwin, returns the host’s IP address.

Resolution:

Uses either the scutil program to get the localhost name, or parses output of ifconfig for a MAC address.

(↑ Back to top)


is_virtual

Returns true or false if a machine is virtualized or not.

Resolution:

Hypervisors and the like may be detected as a virtual type, but are not actual virtual machines, or should not be treated as such. This determines if the host is actually virtualized.

(↑ Back to top)


kernel

Returns the operating system’s name.

Resolution:

Uses Ruby’s rbconfig to find host_os, if that is a Windows derivative, the returns ‘windows’, otherwise returns “uname -s” verbatim.

(↑ Back to top)


kernelmajversion

Returns the operating system’s release number’s major value.

Resolution:

Takes the first 2 elements of the kernel version as delimited by periods.

(↑ Back to top)


kernelrelease

Returns the operating system’s release number.

Resolution:

  • On AIX returns the output from the “oslevel -s” system command.
  • On Windows based systems, uses the win32ole gem to query Windows Management for the ‘Win32_OperatingSystem’ value.
  • Otherwise uses the output of “uname -r” system command.

(↑ Back to top)


kernelversion

Returns the operating system’s kernel version.

Resolution:

  • On Solaris and SunOS based machines, returns the output of “uname -v”.
  • Otherwise returns the ‘kernerlrelease’ fact up to the first ‘-‘. This may be the entire ‘kernelrelease’ fact in many cases.

(↑ Back to top)


lsbdistcodename

Returns Linux Standard Base information for the host.

Resolution:

Uses the lsb_release system command

Caveats:

Only works on Linux (and the kfreebsd derivative) systems. Requires the lsb_release program, which may not be installed by default. Also is as only as accurate as that program outputs.

(↑ Back to top)


lsbdistdescription

Returns Linux Standard Base information for the host.

Resolution:

Uses the lsb_release system command

Caveats:

Only works on Linux (and the kfreebsd derivative) systems. Requires the lsb_release program, which may not be installed by default. Also is as only as accurate as that program outputs.

(↑ Back to top)


lsbdistid

Returns Linux Standard Base information for the host.

Resolution:

Uses the lsb_release system command

Caveats:

Only works on Linux (and the kfreebsd derivative) systems. Requires the lsb_release program, which may not be installed by default. Also is as only as accurate as that program outputs.

(↑ Back to top)


lsbdistrelease

Returns Linux Standard Base information for the host.

Resolution:

Uses the lsb_release system command

Caveats:

Only works on Linux (and the kfreebsd derivative) systems. Requires the lsb_release program, which may not be installed by default. Also is as only as accurate as that program outputs.

(↑ Back to top)


lsbmajdistrelease

Returns the major version of the operation system version as gleaned from the lsbdistrelease fact.

Resolution:

Parses the lsbdistrelease fact for numbers followed by a period and returns those, or just the lsbdistrelease fact if none were found.

Caveats:

lsbmajdistrelease.rb

(↑ Back to top)


lsbrelease

Returns Linux Standard Base information for the host.

Resolution:

Uses the lsb_release system command

Caveats:

Only works on Linux (and the kfreebsd derivative) systems. Requires the lsb_release program, which may not be installed by default. Also is as only as accurate as that program outputs.

(↑ Back to top)


macaddress

Returns the MAC address of the primary network interface.

(↑ Back to top)


macaddress_{NETWORK INTERFACE}

Returns the MAC address for a specific network interface (from the list in the interfaces fact).

(↑ Back to top)


macosx_buildversion

Returns the system’s Mac OS X build version.

(↑ Back to top)


macosx_productname

Returns the system’s Mac OS X product name. Will almost always be “Mac OS X”.

(↑ Back to top)


macosx_productversion

Returns the system’s full Mac OS X version number. (e.g. 10.7.4)

(↑ Back to top)


macosx_productversion_major

Returns the system’s major Mac OS X version number. (e.g. 10.7)

(↑ Back to top)


macosx_productversion_minor

Returns the system’s minor Mac OS X version number. (e.g. 4)

(↑ Back to top)


manufacturer

Returns the hardware’s manufacturer information.

Resolution:

  • On OpenBSD, queries sysctl values, via a util class.
  • On SunOS Sparc, uses prtdiag via a util class.
  • On Windows, queries the system via a util class.
  • Uses util/manufacturer.rb for fallback parsing.

(↑ Back to top)


memoryfree

Returns the amount of free memory on the system.

(↑ Back to top)


memorysize

Returns the total amount of memory on the system.

(↑ Back to top)


memorytotal

Synonym for memorysize. Deprecated.

(↑ Back to top)


netmask

Returns the netmask for the main interfaces.

Resolution:

Uses the facter/util/netmask library routines.

(↑ Back to top)


netmask_{NETWORK INTERFACE}

Returns the netmask for a specific network interface (from the list in the interfaces fact).

(↑ Back to top)


network_{NETWORK INTERFACE}

Returns the network for a specific network interface (from the list in the interfaces fact).

(↑ Back to top)


operatingsystem

Returns the name of the operating system.

Resolution:

  • If the kernel is a Linux kernel, check for the existence of a selection of files in /etc/ to find the specific flavour.
  • On SunOS based kernels, return Solaris.
  • On systems other than Linux, use the kernel value.

(↑ Back to top)


operatingsystemrelease

Returns the release of the operating system.

Resolution:

  • On RedHat derivatives, returns their ‘/etc/<variant>-release’ file.
  • On Debian, returns ‘/etc/debian_version’.
  • On Ubuntu, parses ‘/etc/issue’ for the release version.
  • On Suse, derivatives, parses ‘/etc/SuSE-release’ for a selection of version information.
  • On Slackware, parses ‘/etc/slackware-version’.
  • On Amazon Linux, returns the ‘lsbdistrelease’ value.
  • On all remaining systems, returns the ‘kernelrelease’ value.

(↑ Back to top)


osfamily

Returns the operating system family.

Resolution:

Maps operating systems to operating system families, such as Linux distribution derivatives. Adds mappings from specific operating systems to kernels in the case that it is relevant.

Caveats:

This fact is completely reliant on the operatingsystem fact, and no heuristics are used.

(↑ Back to top)


path

Returns the $PATH variable.

Resolution:

Gets $PATH from the environment.

(↑ Back to top)


physicalprocessorcount

Returns the number of physical processors.

Resolution:

Attempts to use sysfs to get the physical IDs of the processors. Falls back to /proc/cpuinfo and “physical id” if sysfs is not available.

(↑ Back to top)


processor

Additional Facts about the machine’s CPUs. Only used on BSDs.

(↑ Back to top)


processor{NUMBER}

One fact for each processor, with processor info.

Resolution:

  • On Linux and kFreeBSD, parse /proc/cpuinfo for each processor.
  • On AIX, parse the output of lsdev for its processor section.
  • On Solaris, parse the output of kstat for each processor.
  • On OpenBSD, use uname -p and the sysctl variable for hw.ncpu for CPU count.

(↑ Back to top)


processorcount

Returns the number of processors in the machine.

(↑ Back to top)


productname

Returns the model identifier of the machine.

(↑ Back to top)


ps

Internal fact for what to use to list all processes. Used by Service{} type in Puppet.

Resolution:

Assumes ps -ef for all operating systems other than BSD derivatives, where it uses ps auxwww.

(↑ Back to top)


puppetversion

Returns the version of puppet installed.

Resolution:

Requres puppet via Ruby and returns its version constant.

(↑ Back to top)


rubysitedir

Returns Ruby’s site library directory.

Resolution:

Works out the version to major/minor (1.8, 1.9, etc), then joins that with all the $: library paths.

(↑ Back to top)


rubyversion

Returns the version of Ruby facter is running under.

Resolution:

Returns RUBY_VERSION.

(↑ Back to top)


selinux

Determine whether SE Linux is enabled on the node.

Resolution:

Checks for the existence of the enforce file under the SE Linux mount point (e.g. /selinux/enforce) and returns true if /proc/self/attr/current does not contain kernel.

(↑ Back to top)


selinux_config_mode

Returns the configured SE Linux mode (e.g. enforcing, permissive, or disabled).

Resolution:

Parses the output of sestatus_cmd and returns the value of the line beginning with Mode from config file:.

(↑ Back to top)


selinux_config_policy

Returns the configured SE Linux policy (e.g. targeted, MLS, or minimum).

Resolution:

Parses the output of sestatus_cmd and returns the value of the line beginning with Policy from config file:.

(↑ Back to top)


selinux_current_mode

Returns the current SE Linux mode (e.g. enforcing, permissive, or disabled).

Resolution:

Parses the output of sestatus_cmd and returns the value of the line beginning with Current mode:.

(↑ Back to top)


selinux_enforced

Returns whether SE Linux is enabled (true) or not (false).

Resolution:

Returns the value found in the enforce file under the SE Linux mount point (e.g. /selinux/enforce).

(↑ Back to top)


selinux_mode

Returns the value of selinux_config_policy. Deprecated.

(↑ Back to top)


selinux_policyversion

Returns the current SE Linux policy version.

Resolution:

Reads the content of the policyvers file found under the SE Linux mount point, e.g. (/selinux/policyvers).

(↑ Back to top)


serialnumber

Returns the machine’s serial number.

(↑ Back to top)


sp_{SYSTEM PROFILER DATA}

Returns info retrieved in bulk from the OS X system profiler. The names of these facts should be self explanatory, and they are otherwise undocumented. The full list of these facts is:

  • sp_64bit_kernel_and_kexts
  • sp_boot_mode
  • sp_boot_rom_version
  • sp_boot_volume
  • sp_cpu_interconnect_speed
  • sp_cpu_type
  • sp_current_processor_speed
  • sp_kernel_version
  • sp_l2_cache_core
  • sp_l3_cache
  • sp_local_host_name
  • sp_machine_model
  • sp_machine_name
  • sp_mmm_entry
  • sp_number_processors
  • sp_os_version
  • sp_packages
  • sp_physical_memory
  • sp_platform_uuid
  • sp_secure_vm
  • sp_serial_number
  • sp_smc_version_system
  • sp_uptime
  • sp_user_name

(↑ Back to top)


sshdsakey

Returns the host’s SSH DSA key.

(↑ Back to top)


sshecdsakey

Returns the host’s SSH ECDSA key.

(↑ Back to top)


sshrsakey

Returns the host’s SSH RSA key.

(↑ Back to top)


swapencrypted

Say whether the system’s swap space is encrypted. Only used on Darwin.

(↑ Back to top)


swapfree

Returns the amount of free swap on the system.

(↑ Back to top)


swapsize

Returns the total amount of swap space available on the system.

(↑ Back to top)


timezone

Returns the machine’s time zone.

Resolution:

Uses’s Ruby’s Time module’s Time.new call.

(↑ Back to top)


type

Returns the machine’s chassis type.

(↑ Back to top)


uniqueid

Returns the output of the hostid command.

(↑ Back to top)


uptime

Returns the system uptime in a human readable format.

Resolution:

Does basic maths on the “uptime_seconds” fact to return a count of days, hours and minutes of uptime

(↑ Back to top)


uptime_days

Returns the total days of uptime.

Resolution:

Divides uptime_hours fact by 24.

(↑ Back to top)


uptime_hours

Returns the total hours of uptime.

Resolution:

Divides uptime_seconds fact by 3600.

(↑ Back to top)


uptime_seconds

Returns the total seconds of uptime.

Resolution:

  • Using the ‘facter/util/uptime.rb’ module, try a verity of methods to acquire the uptime on Unix.
  • On Windows, the module calculates the uptime by the “LastBootupTime” Windows management value.

(↑ Back to top)


virtual

Determine if the system’s hardware is real or virtualized.

Resolution:

Assumes physical unless proven otherwise.

  • On Darwin, uses the macosx util module to acquire the SPDisplaysDataType and from that parses it to see if it’s VMWare or Parallels pretending to be the display.
  • On Linux, BSD, Solaris, and HPUX: Much of the logic here is obscured behind util/virtual.rb, which rather than document here, which would encourage drift, just refer to it. The Xen tests in here rely on /sys and /proc, and check for the presence and contents of files in there. If after all the other tests it’s still seen as physical, then it tries to parse the output of lspci, dmidecode and prtdiag for obvious signs of being under VMWare, Parallels, or VirtualBox. Finally, it checks for the existence of vmware-vmx, which would hint it’s VMWare.

Caveats:

Many checks rely purely on existence of files.

(↑ Back to top)


vlans

On Linux, return a list of all the VLANs on the system.

Resolution:

On Linux only, checks for and reads /proc/net/vlan/config and parses it.

(↑ Back to top)


xendomains

Returns the list of Xen domains on the Dom0.

Resolution:

On a Xen Dom0 host, return a list of Xen domains using the ‘util/xendomains’ library. No support for Solaris 9 and below, where zones are not available.

(↑ Back to top)

↑ Back to top