Thanks Syed. I added a validation step and that is failing. 

Updated playbook
-----------------------------------
---
  2 - name: Test playbook
  3   hosts: localhost
  4   connection: local
  5   vars:
  6       test: hello
  7
  8   tasks:
  9      - name: test var
 10        debug:
 11            msg: "{{ test }}"
 12        register: test_out
 13
 14      - debug:
 15            var: test_out
 16
 17      - name: verify var
 18        assert:
 19          that:
 20            - "'{{ test_out.test }}' == hello'"


Output:
PLAY [Test playbook] 
***********************************************************************************************************************************************************************************

TASK [Gathering Facts] 
*********************************************************************************************************************************************************************************
ok: [localhost]

TASK [test var] 
****************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "hello"
}

TASK [debug] 
*******************************************************************************************************************************************************************************************
ok: [localhost] => {
    "test_out": {
        "changed": false,
        "failed": false,
        "msg": "hello"
    }
}

TASK [verify var] 
**************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'dict object' has no attribute 
'test'\n\nThe error appears to have been in '/home/ox/test.yml': line 17, 
column 8, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n     - name: verify 
var\n       ^ here\n"}
        to retry, use: --limit @/home/ox/test.retry

PLAY RECAP 
*********************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=1

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d81834fd-51c2-4da0-a5bc-aabf2a2a1d90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to