I have this output
- name: list image exist on nexu
debug:
var: check_image_exist.stdout_lines
tags:
- check_image_exist
ok: [workstation] => {
"check_image_exist.stdout_lines": [
"{",
" "items" : [ {",
" "downloadUrl" : "http://cluster.repo.local:8081/repository/docker_hosted/v2/-/blobs/sha256:aeab776c48375e1a61810a0a5f59e982e34425ff505a01c2b57dcedc6799c17b",",
" "repository" : "docker_hosted",",
" "format" : "docker",",
" "checksum" : {",
" },",
" "contentType" : "application/vnd.docker.image.rootfs.diff.tar.gzip",",
" } ],",
" "continuationToken" : null",
"}"
]
}
I need check continuationToken
null is not, when I use check_image_exist.stdout_lines.continuationToken
I get variable not defined!
How do I check?
You do not have a JSON in the return of your command but a string representation of a JSON, you need to:
stdout
property of tour dictionary, so you have the whole string and not a list of strings, like the one provided bystdout_lines
from_json
in order to have that switch that string to a JSONSo, all together: