konono / konono.easyconf / 1.0.3 / module / ezconf easy yaml and json config editor | "added in version" 2.11 of konono.easyconf" Authors: Yuki Yamashita (@konono) preview | supported by communitykonono.easyconf.ezconf (1.0.3) — module
Install with ansible-galaxy collection install konono.easyconf:==1.0.3
collections: - name: konono.easyconf version: 1.0.3
This is a module that makes it easy to configure a config file with a data structure
- name: 'Test add pattern 1 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'config.d' value: 30 state: 'present'
- name: 'Test add pattern 2 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'config.a-b' value: 'c' state: 'present'
- name: 'Test add pattern 3 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'config.e' value: [1,2,3,4] state: 'present'
- name: 'Test add pattern 4 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'config.f' value: [{a: 1, b: 2},{c: 3, d: 4}] state: 'present'
- name: 'Test add pattern 5 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'lists[2]' value: 100 state: 'present'
- name: 'Test modify pattern 1 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'config.a' value: 100 state: 'present'
- name: 'Test modify pattern 2 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'lists[0]' value: 100 state: 'present'
- name: 'Test delete pattern 1 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'lists[0]' value: 0 state: 'absent'
- name: 'Test delete pattern 2 yaml' konono.easyconf.easyconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'lists[0]' value: 100 state: 'absent'
- name: 'Test check pattern 1 yaml' konono.easyconf.ezconf: src: '{{ playbook_dir }}/tests/test.yml' key: 'my' state: 'check' register: res
key: description: - Set the key you want to edit. The input should be in json format. required: true src: description: - Set the path to the config target. required: true state: description: - Set the state taht present or absent, check. required: false value: description: - Set the value to be assigned to key. required: false backup: description: - Set the true if you need src file backup. required: false
value: description: Return the value of the key that was matched if set check to the state. returned: success sample: value type: raw