Rheinwerk.yedit

Yedit Repository

Ansible Role: Yedit

This repository contains an Ansible module for modifying YAML files. I found it challenging to edit YAML files and manage configurations using Ansible, so I created this solution.

Install

You can install it via Ansible Galaxy:

$ ansible-galaxy install kwoodson.yedit

If you do this, you should also create a requirements.yml file to let other users of your playbook know what dependencies to install:

---
- src: kwoodson.yedit

You can reference it in a playbook by including it before using it:

  roles:
    - kwoodson.yedit
    - role-that-uses-yedit

Examples

Sometimes, you need to manage .yml files with configuration settings.

- hosts: localhost
  gather_facts: no
  roles: 
  - kwoodson.yedit
  tasks:
  - name: Manage YAML files
    yedit:
      src: /tmp/test.yaml
      key: a.b.c
      value:
        d:
          e:
            f:
              this is a test

  - name: Get a specific value
    yedit:
      src: /tmp/test.yaml
      state: list
      key: a.b.c.d.e.f
    register: yeditout

  - debug: var=yeditout

Development

Since this is a role, just copy it into any roles directory recognized by Ansible. For more details, see the Ansible documentation:

Documentation

You can find the complete documentation inline here.

Informazioni sul progetto

A yaml/json editing module for idempotent edits.

Installa
ansible-galaxy install Rheinwerk.yedit
Licenza
Unknown
Download
7.8k
Proprietario