Forge Home

hiera_redis

A Hiera 5 backend for Redis with HASH type checking into redis key data

991 downloads

344 latest version

5.0 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.3.0 (latest)
  • 0.2.0 (deleted)
  • 0.1.0 (deleted)
released Jul 19th 2022
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.7.0 < 7.0.0
  • , , , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'mrnobody-hiera_redis', '0.3.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add mrnobody-hiera_redis
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install mrnobody-hiera_redis --version 0.3.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

mrnobody/hiera_redis — version 0.3.0 Jul 19th 2022

hiera_redis

Table of Contents

  1. Description
  2. Setup - The basics of getting started with hiera_redis
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module
  6. Credits - credits to developers

Description

This module provides a Hiera 5 backend for Redis. With support recieve from redis hash instead String only. JSON requered for this module. Also support interpolate results from redis - patterns in result like %{hiera('somekey')} or %{lookup('somekey')} will be replaced to somekey value from Hiera.

Setup

Setup Requirements

The backend requires the redis gem installed in the Puppet Server JRuby. It can be installed with:

/opt/puppetlabs/bin/puppetserver gem install redis

It is also recommended to install the gem into the agent's Ruby:

/opt/puppetlabs/puppet/bin/gem install redis

This allows commands such as puppet apply or puppet lookup to use the backend.

Also need to install json gem

Beginning with hiera_redis

If Redis is running on the Puppet master with the default settings, specifying the lookup_key as 'redis_lookup_key' is sufficient, for example:

---
version: 5
hierarchy:
  - name: hiera_redis
    lookup_key: redis_lookup_key

Usage

By default, the backend will query Redis with the key provided. It is also possible to query multiple scopes such as with the YAML backend, where the expected key in Redis is composed of the scope and the key separated by a character (default is :). For example, the following can be used:

---
version: 5
hierarchy:
  - name: hiera_redis
    lookup_key: redis_lookup_key
    options:
      confine_to_keys:
        - '^redis_.*'
        - '^myapp_.*'
        - '^ssh_group$'
      scopes:
        - "osfamily/%{facts.os.family}"
        - common

The backend then expects keys of a format such as common:foo::bar for a lookup of 'foo::bar'.

The other options available include:

  • host: The host that Redis is located on. Defaults to 'localhost'.
  • port: The port that Redis is running on. Defaults to 6379.
  • socket: Optional Unix socket path
  • password: Optional Redis password
  • db: The database number to query on the Redis instance. Defaults to 0.
  • scope: The scope to use when querying the database.
  • scopes: An array of scopes to query. Cannot be used in conjunction with the scope option.
  • separator: The character separator between the scope and key being queried. Defaults to ':'.
  • confine_to_keys: Only use this backend if the key matches one of the regexes in the array.
  • connect_timeout: connect timeout to redis, seconds. Default 0.5
  • read_timeout: read timeout for redis, seconds. Default 0.5
  • write_timeout: write timeout for redis, seconds. Default 0.5

confine_to_keys config example:

  confine_to_keys:
    - "application.*"
    - "apache::.*"

Limitations

Tested partly for puppet5, use for you own risk.

Credits

This repository was initially a fork from maxadamo hiera_redis repo, forked for add some fix.

The code to related to add supporting of getting hashes also from hiera redis storage. For now if in recieved result from redis we have "{" and "}" symvols, we will change type of result as HASH and puppet will be use result from redis as hash.