kwoodson.yedit
// vim: ft=asciidoc
= yedit Repository :toc: macro :toc-title:
toc::[]
== Ansible Rolle: Yedit
Dieses Repository enthält ein Ansible-Modul zur Bearbeitung von YAML-Dateien.
Ich habe keine gute Methode gefunden, um YAML-Dateien zu bearbeiten und sie über Ansible zu verwalten. Dies ist mein Versuch.
== Installation
Du kannst es über Ansible Galaxy installieren:
$ ansible-galaxy install kwoodson.yedit
Wenn du das machst, solltest du auch eine requirements.yml
hinzufügen, damit andere Benutzer deines Playbooks wissen, welche Abhängigkeiten installiert werden müssen:
---
- src: kwoodson.yedit
Du kannst es dann in einem Play verwenden, indem du es vorher importierst:
roles:
- kwoodson.yedit
- rolle-die-yedit-verwendet
== Beispiele
Manchmal ist es notwendig, .yml-Dateien zu verwalten. [source,yaml]
- hosts: localhost
gather_facts: no
roles:
kwoodson.yedit tasks:
name: YAML-Dateien verwalten yedit: src: /tmp/test.yaml key: a.b.c value: d: e: f: dies ist ein Test
name: Einen bestimmten Wert abrufen yedit: src: /tmp/test.yaml state: list key: a.b.c.d.e.f register: yeditout
debug: var=yeditout
== Entwicklung
Da dies eine Rolle ist, kopiere sie einfach in ein beliebiges Verzeichnis, das von Ansible erkannt wird. Für Details siehe http://docs.ansible.com/ansible/latest/index.html[Ansible-Dokumentation]:
- http://docs.ansible.com/ansible/devel/playbooks_reuse_roles.html#embedding-modules-and-plugins-in-roles[Module und Plugins in Rollen einbetten]
- http://docs.ansible.com/ansible/latest/intro_configuration.html#module-utils[module_utils]
== Dokumentation
Die vollständige Dokumentation ist inline verfügbar https://github.com/kwoodson/ansible-role-yedit/blob/master/library/yedit.py#L15[hier].
ansible-galaxy install kwoodson.yedit