Forge Home

facts

Tasks that inspect the value of system facts

341,576 downloads

4,367 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.6.0 (latest)
  • 1.5.0
  • 1.4.0
  • 1.3.0
  • 1.2.0
  • 1.1.0
  • 1.0.0
  • 0.6.0
  • 0.5.1
  • 0.5.0
  • 0.4.1
  • 0.3.1
  • 0.2.0
  • 0.1.2
  • 0.1.0
released Aug 7th 2024
This version is compatible with:
  • Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
  • Puppet >= 7.0.0 < 9.0.0
  • , , , ,
Tasks:
  • facts
Plans:
  • facts
  • external
  • info

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'puppetlabs-facts', '1.6.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppetlabs-facts
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppetlabs-facts --version 1.6.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

puppetlabs/facts — version 1.6.0 Aug 7th 2024

facts

Table of Contents

  1. Description
  2. Requirements
  3. Usage
  4. Reference - An under-the-hood peek at what the module is doing and how

Description

This module provides a collection of facts tasks and plans all of which retrieve facts from the specified targets but each of them processes the retrieved facts differently. The provided plans are:

  • facts - retrieves the facts and then stores them in the inventory, returns a result set wrapping result objects for each specified target which in turn wrap the retrieved facts
  • facts::info - retrieves the facts and returns information about each target's OS compiled from the os fact value retrieved from that target

The provided tasks:

  • facts - retrieves the facts and without further processing returns a result set wrapping result objects for each specified target which in turn wrap the retrieved facts (this task is used by the above plans). This task relies on cross-platform task support; if unavailable, the individual implementations can be used instead.
  • facts::bash - bash implementation of fact gathering, used by the facts task.
  • facts::powershell - powershell implementation of fact gathering, used by the facts task.
  • facts::ruby - ruby implementation of fact gathering, used by the facts task.

puppet_agent module support: The puppet_agent::install_shell task uses the bash.sh implementation code to gather facts. When bash.sh is invoked with the positional argument platform or release only the requested fact is returned.

Example

root@y77tzpv6qxnx5at:~# ./bash.sh 
{
  "os": {
    "name": "Ubuntu",
    "release": {
      "full": "16.04",
      "major": "16",
      "minor": "04"
    },
    "family": "Debian"
  }
}
root@y77tzpv6qxnx5at:~# ./bash.sh "release"
16.04
root@y77tzpv6qxnx5at:~# ./bash.sh "platform"
Ubuntu

Requirements

This module is compatible with the version of Puppet Bolt it ships with.

Usage

To run the facts plan run

bolt plan run facts --targets target1.example.com,target2.example.com

Parameters

All plans have only one parameter:

  • targets - The targets to retrieve the facts from.

Reference

The core functionality is implemented in the facts task, which provides implementations for the shell, powershell, and puppet-agent features. The powerhsell and bash implementations of the task compile and return information mimicking that provided by facter's os fact. When the puppet-agent feature is available the ruby implementation will return the result running facter --json on the target.