Forge Home

add_facts

Adds facts to a node.

10,710 downloads

9,844 latest version

4.3 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.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 1.1.0 (latest)
  • 1.0.0
released Jul 21st 2016
This version is compatible with:
  • Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.0.0 < 5.0.0

Start using this module

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

Add this module to your Puppetfile:

mod 'jebas-add_facts', '1.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jebas-add_facts
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jebas-add_facts --version 1.1.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
Tags: facts, facter, fact

Documentation

jebas/add_facts — version 1.1.0 Jul 21st 2016

add_facts

Table of Contents

  1. Description
  2. Setup - The basics of getting started with add_facts
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

Add_facts could be thought of as a temporary or permanent replacement to an ENC. Though it will not handle environment changes, it will add external facts stored in the hieradata so that the next pass will alter puppet's behavior.

Like most ENCs, it can be used to provide additional information that puppet uses to create a catalog. This could include defining the application installed (web, database, file server...), the application environment (prod, qa, dev...), or location (London, Atlanta, downstairs...). All of this is information that usually cannot be derived from a newly installed machine.

However, unlike an ENC, add_facts creates an add_facts.yaml file, and places it into the facts.d directory. This allows the information to always remain with the node and bed stored in the hieradata.

Setup

What add_facts affects

Add_facts affects the output of facter.

After the module is applied, facter will start displaying the facts added by the module.

Setup Requirements

To make full use of add_facts, you should also make changes in your hiera configuration file. If you are a fact called app to your node, you might want to add an entry to the hiera.yaml that reads, '- "apps/%{facts.app}"' to take advantage of the information.

Beginning with add_facts

Using the add_facts module involves two steps.

  • Use the base class to establish the facts.d directory.
  • Use the add_facts::entry or add_facts::entries to add the information.

Usage

  • Installing the base class.

    The base class is used to determine the location of the facts.d directory, 
    

    and by default it is '/opt/puppetlabs/facter/facts.d'. The only variable is directory. Therefore the class can be called by either

        class { 'add_facts': }
    
    or
    
        class { 'add_facts':
            directory => '/etc/fact/facts.d',
        }
    
  • Using add_facts::entry

    Entry is a wrapper around ini_setting, which is used to add and remove
    

    the fact entries. The following is an example entry.

        add_facts::entry { 'app':
            ensure => present,
            value  => 'web',
        }
    
  • Using add_facts::entries

    Entries is a hieradata wrapper around entry.  It allows you enter several 
    

    items at once. First enter the hieradata into an existing file. The following example could be placed into the hieradata/nodes/web10.example.com.yaml file.

        classes:
            - add_facts
            - add_facts::entries
    
        add_facts::entries::args:
            app:
                value: web
            app_env:
                value: qa
    
    Of course the above example is assuming that manifest is using some 
    

    equivalent to hiera_include.

Reference

  • Classes
    • add_facts
    • add_facts::entries
  • Defined Types
    • add_facts::entry

Limitations

This module creates a two pass deployment. The first pass adds the facts to the node, and the second pass creates the catalog based on the new facts.

Development

This module was developed using beaker. To run the tests use:

PUPPET_INSTALL_TYPE=agent rspec spec/acceptance

Release Notes/Contributors/Etc.

This is the initial release.