How to extract a specific value from register output:
From the below register output I’m trying to extract the path value with no luck, I have tried few options but still, I’m falling
- debug:
msg: “{{ file_name }}” - debug:
msg: “{{ file_name.results.path }}” - debug:
msg: “{{ file_name.path }}”
File_name register output
“msg”: {
“changed”: false,
“msg”: “All items completed”,
“results”: [
{
“ansible_loop_var”: “item”,
“changed”: false,
“checksum”: “45823e35872e278fe781a182aa50abcd92d2df62”,
“dest”: “/data/nifi-deployment/file_32.tar.gz”,
“diff”: {
“after”: {
“path”: “/data/nifi-deployment/file_32.tar.gz”
},
“before”: {
“path”: “/data/nifi-deployment/file_32.tar.gz”
}
},
“failed”: false,
“gid”: 0,
“group”: “root”,
“invocation”: {
“module_args”: {
“_diff_peek”: null,
“_original_basename”: " file_32.tar.gz ",
“access_time”: null,
“access_time_format”: “%Y%m%d%H%M.%S”,
“attributes”: null,
“backup”: null,
“content”: null,
“delimiter”: null,
“dest”: “/data/nifi-deployment”,
“directory_mode”: null,
“follow”: true,
“force”: true,
“group”: null,
“mode”: null,
“modification_time”: null,
“modification_time_format”: “%Y%m%d%H%M.%S”,
“owner”: null,
“path”: “/data/nifi-deployment/file_32.tar.gz”,
“recurse”: false,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: null,
“state”: “file”,
“unsafe_writes”: null
}
},
“item”: "/repo/file_32.tar.gz ",
“mode”: “0644”,
“owner”: “root”,
“path”: “/data/nifi-deployment/file_32.tar.gz”,
“secontext”: “system_u:object_r:default_t:s0”,
“size”: 4938,
“state”: “file”,
“uid”: 0
}
]
}
}