ansible-jsonpatch
ansible-jsonpatch copied to clipboard
quotation marks are force at integers
I've a json with like this: { "bla": 3, "devices": [ { "dummy": "/var" }, { "tempdir": "/var/temp", "memlimit": 100, "units": 50 } ] }
and try to change the unit value from 50 to 250 with following ansible code:
- name: "manage json file test" json_patch: src: "{{ src }}" dest: "{{ dest }}" pretty: yes operations: - op: replace path: devices/1/units value: 250
but regardless of how I write the value, the result is always "units": "250" (with quotation marks around the integer). If I replace the whole inner curly bracket (tempdir, memlimit, units) like this:
path: devices/1 value: '{ "tempdir": "/var/temp", "memlimit": 100, "units": 250 }'
it works. But I think there must be a way to output a number without quotation marks, right? (sorry, I haven't figured out how to make indentations here)