2015-10-07 21 views

risposta

14

Ho anche la necessità di configurare i file yaml. Ho scritto un modulo ansible che tenta di essere idempotente durante la modifica dei file yaml.

Io lo chiamo yedit (yaml-edit). https://github.com/kwoodson/yedit

Per favore fatemi sapere se lo trovate utile. Aggiungerò funzionalità quando il nostro team risponde all'esigenza, su richiesta o tramite pull-request.

Ecco un semplice esempio playbook:

roles: 
- lib_yaml_editor 

tasks: 
- name: edit some yaml 
    yedit: 
    src: /path/to/yaml/file 
    key: foo 
    value: bar 

- name: more complex data structure 
    yedit: 
    src: /path/to/yaml/file 
    key: a#b#c#d 
    value: 
     e: 
     f: This is a test 

dovrebbero produrre qualcosa che assomiglia a questo:

foo: bar 
a: 
    b: 
    c: 
     d: 
     e: 
      f: This is a test 
+0

wow , grazie mille per questo heads-up - avrò uno sguardo quando ho g et ad esso, occupato con altre cose in questo momento – chichak

+0

Modulo molto bello ... Non sapevo che ora potresti installare un ruolo e utilizzarlo direttamente ... Letteralmente _mio la mia mente_. –

Problemi correlati