One shell command returns a json structure, but ansible converts it into a
string in the registered variable.
In order to access some attributes, this string needs to be unquoted, but
how?
There is a quote filter, but *there is no unquote filter in ansible or
jinja2*.
For instance, let's suppose a shell module returns the following registered
variable:
return:
changed: true
cmd: |-
cmd_returning_json
delta: '0:00:00.002283'
end: '2022-07-28 11:09:17.921175'
failed: false
msg: ''
rc: 0
start: '2022-07-28 11:09:17.918892'
stderr: ''
stderr_lines: []
stdout: '{"class": "data", "id":
"a61b96e7-427e-493a-993c-c3efc8a16aa1", "size": "500GB", "type": "ssd"}'
How do we convert return.stdout into:
{"class": "data", "id": "a61b96e7-427e-493a-993c-c3efc8a16aa1", "size":
"500GB", "type": "ssd"}
so that we can access for instance:
return.stdout.id
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/0375e9fe-4e94-4c6c-ae3b-9773fe4ce287n%40googlegroups.com.