The following task will find that:
- debug:
msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',
'ess')|first|first }}"
That takes the `hostinfo` dict, turns it into a list of tuples, selects
where `hostclass` equals `ess`, gets the first result (there should only be
one
i am having a problem in finding solution. I have a piece of file which
contains data in below format (json type with quotes)::-
hostinfo:
'host001':
ip: x.x.x.x
hostclass: 'puppet'
'host002':
ip: y.y.y.y
hostclass: 'ess'
'host003':
ip: z.z.z.z
hostclass: 'mdb'