zuul-jobs/test-playbooks/update-json-file.yaml

41 lines
957 B
YAML

- hosts: all
tasks:
- include_role:
name: update-json-file
vars:
update_json_file_name: some/test.json
update_json_file_default:
foo: bar
update_json_file_combine:
moo: boo
update_json_file_debug: true
- include_role:
name: update-json-file
vars:
update_json_file_name: some/test.json
update_json_file_combine:
new: content
a:
- list
- of
- items
update_json_file_debug: true
- name: Load resulting merged file
slurp:
path: 'some/test.json'
register: _file
- name: Parse merged file
set_fact:
_config: "{{ _file.content | b64decode | from_json }}"
- assert:
that:
- _config['foo'] == 'bar'
- _config['moo'] == 'boo'
- _config['new'] == 'content'
- _config['a'] == ['list', 'of', 'items']