GithubHelp home page GithubHelp logo

vstone / puppet-safe_roles Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geoffwilliams/puppet-safe_roles

0.0 1.0 0.0 86 KB

refomat any `role` or `pp_role` fact into a safe fact with the colons replaced by underscores

License: Apache License 2.0

Shell 4.13% Ruby 75.69% Makefile 5.25% PowerShell 14.93%

puppet-safe_roles's Introduction

safe_roles

Table of Contents

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

Description

Just a very simple module to convert:

roles

  • A role fact role into a safe_role
  • A trusted fact role pp_role into safe_pp_role

The conversion process is to convert double colons (::) into slashes (/).

os

  • A normalised safe_os fact:
    • All values lowercased (eg: RedHat -> redhat)
    • All spaces removed from values (eg 2012 R2 -> 2012_r2)

This lets us write hiera.yaml files that look like this:

:hierarchy:
  - "node/%{clientcert}".yaml
  - "%{safe_role}".yaml
  - "app_tier/%{app_tier}".yaml
  - "datacenter/%{datacenter}".yaml
  - "env/%{environment}".yaml
  - "os/%{facts.safe_os.family}_%{facts.safe_os.release.major}.yaml"
  - common.yaml

This means that:

  • A node that has a role or pp_role value of foo::bar::baz will attempt to read hiera data from role/foo/bar/baz.yaml (instead of role/foo::bar::baz.yaml)
  • A windows 2012 R2 node would attempt to read from os/windows_2012_r2.yaml (instead of os/windows_2012 R2.yaml)
  • A RHEL 7 node would attempt to read read from os/redhat_7.yaml (instead of os/RedHat_7.yaml)

This resolves the problems that:

  • :: in filenames only works on linux
  • Windows and MacOS have case insensitive filesystems which can result in broken git repositories when files are checked in accidentally that differ only by case
  • Filenames need spaces when dealing with some Windows variants

Setup

Just install the module and the facts will be created if applicable

Limitations

  • Requires openssl in the PATH

Development

  • Feel free to PR

puppet-safe_roles's People

Contributors

geoffwilliams avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.