Skip to content

honibis/ansible-role-yedit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yedit repository

Ansible Role: Yedit

This repository contains an ansible module for modifying yaml files.

I didn’t see a good method of editing yaml files and config managing them through ansible. This is my attempt.

Install

You can install via Ansible Galaxy:

$ ansible-galaxy install kwoodson.yedit

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

---
- src: kwoodson.yedit

You can then reference it in a play by importing it before use:

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

Examples

Sometimes it is necessary to config manage .yml files.

- 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

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

Documentation

Full documentation is available inline here.

About

Ansible Role for Yaml editing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%