Q: "id of the latest event"
A: The task
- debug:
msg: "{{ l|map(attribute='id')|max }}"
gives
msg: '11'
In addition to this, the oneliner task
- debug:
msg: "{{ (l|items2dict(key_name='id', value_name='message'))[l|map(attribute='id')|max] }}"
gives the message of the latest id
msg: Something happened yet again.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…