Closed rebelnn closed 1 year ago
There are a few problems here:
copy
operation is a JSON Patch operation, not an Ansible operation. So the path
you specified as a filename is incorrect, it should actually be a path in JSON notation as described in RFC 6901. An example of this would be /firstObj/secondObj/2/myVal
.copy
operation will copy a value from one path to another path. Right now you're missing the from
path. See this for an example.- name: Ensure the Ansible project is enabled
json_patch:
src: "test8.json"
pretty: yes
create: yes
operations:
- op: add
path: /foo
value: bar
- op: remove
path: /foo
I think that might work as long as the top-level JSON object is an object and not an array? This would just create and remove a dummy value but it's enough to tell the module that something needs to be written because it changed.
Hi, I'm using this module only to convert the format to "pretty" however I get an error message:
my code:
here's my output:
:ansible asd$ ansible --version | grep "python version" python version = 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) [Clang 6.0 (clang-600.0.57)] :ansible asd$ ansible --version ansible 2.9.9
Any idea what could it be?