Forge Home

facter_tags

Turn a directory of JSON files into a facter fact

6,671 downloads

6,671 latest version

4.6 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

  • 0.0.1 (latest)
released Jan 25th 2017
This version is compatible with:
  • , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'jaxxstorm-facter_tags', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jaxxstorm-facter_tags
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jaxxstorm-facter_tags --version 0.0.1

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

jaxxstorm/facter_tags — version 0.0.1 Jan 25th 2017

External Tags for Puppet

Build Status

Installation

What this module does

This module creates a directory, /etc/tags and allows you to create JSON in this directory to create arbitrary tags from a variety of sources. It then evaluates those JSON files and creates a structured fact, tags with them.

It also includes a defined type which allows you to create tags from with Puppet.

You might use this if:

  • You want an external build tool to tag virtual machines/container/hosts
  • You want to extend facter beyond what it does with key value pairs, and want a facter value with a output of tags
  • You are already used to the the concept of tagging in AWS, and want the same ability to use tags in physical infrastructure
  • You have a deployment tool, or multiple deployment tools, which you want to use to tag infrastructure, and you want those tags to be available in facter

Usage

The basic way of using this module is to include it:

include ::facter_tags

Once you've included the module, a directory, /etc/tags will be created which is a directory which will be read by facter.

You can use any tool you like to create JSON files inside this directory, and these will end up as structured facts.

As an example, we create a JSON file in /etc/tags with a JSON array:

# cat /etc/tags/type.json
[
  "infra"
]

This gets is then read by facter:

# facter -p tags
["infra"]

Tags from Puppet

There's also a defined type included which allows you to tag hosts from within Puppet. Using this is as simple as this:

facter_tags::value { 'puppet':
  values => ['infrastructure', 'operations']
}

Your tags will be parsed and then a JSON file will be created inside /etc/tags with the title of your defined type, so in this case /etc/tags/puppet.json.

Make sure you don't have two tools overriding each others JSON files :)

##Limitations

Depends on the JSON gem, or a modern ruby.