Using ANSIBLE: I am getting the json response from url and priting the response but unable to print the particular keys/values. (please see the json response) in my script i would pass Service, so i want to print only particular version of a service under tags only. for e.g i would pass abc as parameter to ansible playbook then i want to print version under that Tags. i tried json query filter but unable to get this.
- name: Get url response
uri:
url: http://localhost:8500/myurl...
return_content: yes
register: json_response
- name: print json_response
debug:
var: json_response
- name: print the response
set_fact:
msg: "{{ json_response | from_json| json_query('Tags['build=*')}}"
my json response would be like this.
"json": {
"abc": {
"Tags": [
"version=3.5"
]
},
"xyz": {
"Tags": [
"version=4.6.2"
]
},
"asd": {
"Tags": [
"version=9.1.2"
]
}
}
Any help would be greatly appreciated.