Version information
This version is compatible with:
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'jaxxstorm-facter_tags', '0.0.1'
Learn more about managing modules with a PuppetfileDocumentation
External Tags for Puppet
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.
Dependencies
- puppetlabs/stdlib (>=1.0.0)
The MIT License (MIT) Copyright (c) 2016 Lee Briggs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.