762ce6e96e
It is perfectly valid to want to add a value to a file that does not exist yet, even the path may be missing. This fixes last night regression when installing docker no longer creates the /etc/docker folder, causing our MTU update to fail. Change-Id: I0f037d1d6664de3c3b777aaf6da9cd7c3e8bb15f Reference: https://review.rdoproject.org/zuul/builds?job_name=tox-py36-ci-config&project=rdo-infra/ci-config
41 lines
957 B
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']
|