zuul-jobs/test-playbooks/update-json-file.yaml
Ian Wienand 58a8d1a119
ansible-lint: add names to blocks/includes, etc.
This adds names to blocks and includes for consistency.  We've done
this before (e.g. Ia7e490aaba99da9694a6f3fdb1bca9838221b30a) but I
guess 6.12.0 is finding more...

Change-Id: Ib451f6d3c5a18047873e63aa0a1aa2b425846fec
2023-02-03 15:06:03 +11:00

44 lines
1.0 KiB
YAML

- hosts: all
tasks:
- name: Run update-json-file
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
- name: Run update-json-file again
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 }}"
- name: Check output
assert:
that:
- _config['foo'] == 'bar'
- _config['moo'] == 'boo'
- _config['new'] == 'content'
- _config['a'] == ['list', 'of', 'items']