Forge Home

puppet_environment_facts

Custom facts to return puppet environment information

284,526 downloads

99,012 latest version

4.1 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.0.0 (latest)
  • 0.3.1
  • 0.3.0
  • 0.2.0
released Sep 22nd 2017

Start using this module

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

Add this module to your Puppetfile:

mod 'reidmv-puppet_environment_facts', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add reidmv-puppet_environment_facts
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install reidmv-puppet_environment_facts --version 1.0.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

reidmv/puppet_environment_facts — version 1.0.0 Sep 22nd 2017

puppet_environment_facts

This module provides custom facts which return the agent-side settings for environment and noop for the puppet run. Besides the value of the setting for the run, a fact is provided that returns whether or not the setting was specified on the command-line

Having these facts available can be useful in Node Classifiers which are authoritative for an environment. The facts allow the classifier to distinguish between when an agent run is requesting an environment different (potentially) from the default, or from the agent's puppet.conf file, what environment it is requesting, and so make informed environment assignment decisions. Similarly, knowning when the agent run is no-op or not may be impactful to assigning its environment.

Facts

agent_specified_environment

This fact is NOT provided by this module, and is actually a fact built in to Puppet. agent_specified_environment is relevant to most use cases this module supports though, and prior to the fact being added to Puppet this module provided an implementation. Now that it's a built in fact, see the documentation for it here.

agent_specified_environment_setbycli

Boolean. Whether or not the environment setting was specified on the CLI (e.g. --environment=dev).

agent_specified_noop

Boolean. The agent-side value of the noop setting.

agent_specified_noop_setbycli

Boolean. Whether or not the environment setting was specified on the CLI (e.g. --noop, or --no-noop).

Example Values

For a user-invoked Puppet agent run, if the following command is given:

puppet agent --test --environment=feature42

These facts will return:

agent_specified_environment=feature42
agent_specified_environment_setbycli=True
agent_specified_noop=False
agent_specified_noop_setbycli=False

For a user-invoked Puppet agent run, if the following command is given and the puppet.conf file does not specify an environment:

puppet agent --test

These facts will return:

agent_specified_environment=nil
agent_specified_environment_setbycli=False
agent_specified_noop=False
agent_specified_noop_setbycli=False

For a user-invoked Puppet agent run, if the following command is given and the puppet.conf file contains environment=dev:

puppet agent --test --noop

These facts will return:

agent_specified_environment=dev
agent_specified_environment_setbycli=False
agent_specified_noop=True
agent_specified_noop_setbycli=True