kwoodson / ansible-role-yedit

Ansible Role for Yaml editing
164 stars 62 forks source link

Issues with --- disappearing #88

Closed o0-o closed 1 year ago

o0-o commented 3 years ago

I have the following in an ansible task:

- block:
...
    - name: Save egress interface to host_vars
      yedit:
        src: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}.yml"
        key: egress.iface
        value: "{{ egress['iface'] }}"
      delegate_to: 127.0.0.1

The key/value is added properly, but the --- at the beginning of the src file disappears. I have confirmed this by copying the file immediately before and after this runs as well as with the built in backup option.