mitre.yedit

Ansible Module: Yedit

This repository has an Ansible module to change YAML files.

It was forked to keep the file's mode when using yedit.

Install

You can install the mitre.yedit role using Ansible Galaxy:

ansible-galaxy install mitre.yedit

If you do this, also add a requirements.yml file so other users of your playbook know what to install:

# requirements.yml
roles:
  - src: mitre.yedit

Examples

Managing .yml files is often needed for configuration management. Here’s how to use the Yedit module in an Ansible playbook:

# playbook.yml
- hosts: localhost
  roles:
    - role: mitre.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

To add this role to your Ansible setup, just place it in any directory that Ansible recognizes as a role directory. For more details on using modules and plugins in roles, check the Ansible documentation links below:

Documentation

Full documentation is available in the role's library file on GitHub. You can find it here.

Informazioni sul progetto

A module designed for idempotent editing of YAML and JSON files

Installa
ansible-galaxy install mitre.yedit
Licenza
other
Download
521
Proprietario
Open Source Software from the MITRE Corporation