Forge Home

manifold

Creates many relationships, based on parameter matching.

25,099 downloads

25,099 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.

Version information

  • 0.0.1 (latest)
released Apr 23rd 2016
This version is compatible with:
  • Puppet Enterprise >=3.0.0
  • Puppet >=3.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 'binford2k-manifold', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add binford2k-manifold
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install binford2k-manifold --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

binford2k/manifold — version 0.0.1 Apr 23rd 2016

Make relationships based on a pattern

  1. Overview
  2. Usage

Overview

The manifold resource type allows you to make relationships on many other resources at once. The relationships are generated at the end of the catalog compilation, and they're generated based on simple pattern-matching on attributes.

You can specify any attribute to match, and you can specify either a string or a regular expression. Unfortunately, this currently only works with native types, so you can create relationships against all package resources tagged with 'internal' but you cannot do the same for all apache::vhost defined resource types.

The pattern matching works like you might expect.

  • If you're matching a string parameter:
    • and you pass a string, it matches using string equality.
    • and you pass a regex, if matches against the regex.
  • If you're matching an array parameter:
    • and you pass a string, it uses string equality to check for membership in that array.
    • and you pass a regex, if uses regex to check for membership in that array.
  • If you invert the match, the result of the above is inverted.
    • String/regex does not match.
    • String/regex doesn't match any array members.

This supports all standard relationships: require, before, subscribe, & notify.

Usage

Example:

manifold { 'internal':
  type         => 'package',
  match        => 'tag',
  pattern      => 'internal',  # or /internal/ to use a regular expression
  relationship => before,
}
package { ['foo', 'bar', 'baz']:
  ensure  => present,
  tag     => 'internal',
}
yumrepo { 'internal':
  ensure   => 'present',
  baseurl  => 'http://yum.example.com/el/7/products/x86_64/',
  descr    => 'Local packages',
  enabled  => '1',
  before   => Manifold['internal'],
}
  • invert Invert the pattern matching. Valid values are true, false.

  • match The parameter name to match on

  • pattern A string or regex pattern to match in combination with the match param

  • query A hash of matches and patterns to use

  • relationship The relationship to enforce from this resource to the matched resources

  • type (namevar) The type of other resource to depend upon

TODO

  • Allow relationships to be set on defined types.
  • Allow more complex patterns to be used, such as matching multiple patterns.

Disclaimer

I take no liability for the use of this module. It's in early stages of development.

Contact

binford2k@gmail.com