Ansible — Nested when statement using the playbook block

---
--
connection: local
gather_facts: false
hosts: hosts
vars:
complex_json: {
"status": {
"name": "nested condition ",
"details": {
"data": {
"data_details": [{"Id": 1}, {"Id": 2}]
}
}
}
}

tasks:
- block:
- block:
- debug:
msg: "{{ complex_json.status.detils }}"
when: "'data2' not in complex_json.status.details"
when: "'data1' not in complex_json.status.details"

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store