1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- hosts: localhost gather_facts: no vars: foo: [] bar: "{{ foo[0] }}" tasks: - debug: msg: "{{ bar }}" register: result ignore_errors: yes - assert: that: - '"foo[0]" in result.msg' - '"object has no element 0" in result.msg'