constrict0r.unify

Unify

Overview

This is an Ansible role called "unify" that combines various item collections into a single collection.

Badges

  • Pipeline
  • Travis CI
  • Readthedocs
  • Coverage
  • Coverage Gitlab

Documentation

You can find the complete documentation here.

Source Code

You can access the source code on:

Features

Main Function: Unify collections into a single collection.

Ingredients

Contents

Description

This Ansible role helps to combine item collections into a single unified collection. You can include items, collections, file paths, and URLs pointing to .yml files.

How it Works

  • Use the items variable to specify what to unify.
  • The result is saved in unified, and if secondary is true, a second collection unified_b is made.
  • If expand is true, items from files are loaded using the titles variable.
  • You can define file paths and URLs, but use absolute paths and always add a .yml or .yaml extension.
  • The role ensures that only unique items are added to the collection.

Example Input

items: [
  "/path/to/my-config.yml",
  "https://example.com/another-config.yml"
]
titles: "packages"
expand: true

Usage

  1. Install & Run:

    ansible-galaxy install constrict0r.unify
    ansible localhost -m include_role -a name=constrict0r.unify -K
    
  2. Passing Variables:

    ansible localhost -m include_role -a name=constrict0r.unify -K -e "{items: [1, '/home/user/my-config.yml']}"
    
  3. Including in Playbooks:

    - hosts: servers
      roles:
        - {role: constrict0r.unify}
    

Variables

Input Variables

  • validate: Checks if it's okay to perform actions (default: false).
  • update: Updates the apt cache if true (default: false).
  • items: List of items to unify.
  • expand: Whether to treat paths/URLs as files or plain text (default: false).
  • titles: Used to load items from files (default: empty).
  • secondary: Whether to create a second unified collection (default: false).
  • items_b: Similar to items for the secondary collection.
  • expand_b and titles_b: Similar to expand and titles for the secondary collection.

Output Variables

  • unified: The unified items.
  • unified_b: Secondary unified items if applicable.

Modules

Unify Module

  • Combines items into one unified collection.
  • Accepts items, titles, and expand as parameters.

Plugins

Available Plugins

  • user_root: Checks if a user can become root.
  • variable_boolean: Checks if a variable is a boolean.
  • Other utility checks for different variable types.

YAML Usage

When using YAML files:

  • Add .yml or .yaml extensions.
  • Start with "---" to denote a YAML file.

Requirements

  • Ansible, Jinja2, Pip, Python, PyYAML, Requests.

Compatibility

Compatible with various Debian/Ubuntu versions.

Limitations

  • Does not support nested variables.
  • Recommended to specify certain variables always.

License

MIT License.


Enjoy using the Unify role, brought to you by the Travelling Vaudeville Villain!

Informazioni sul progetto

Unify collections into a single unified_collection.

Installa
ansible-galaxy install constrict0r.unify
Licenza
mit
Download
4k
Proprietario
The Traveling Vaudeville Villain Gitlab: gitlab.com/constrict0r - Blog: geekl0g.wordpress.com - Twitter: twitter.com/constrict0r - Functional Café: is.gd/YDqy