Need help with registered variable

I have a task output like this:

  • name: Print Response of status resource
    debug:
    msg: " {{ result }}"

ok: [node-3] => {
“msg”: " {‘msg’: u’All items completed’, ‘changed’: False, ‘results’: [{‘ansible_loop_var’: u’item’, ‘failed’: False, ‘changed’: False, u’content’: {u’body’: None, u’node’: u’node-3’, u’allServicesLocked’: True, u’appServer’: u’1’, u’type’: u’iMIME’, u’data’: True,]} "
}

But when i try to access like that in some task, it does not work:
until : result[‘results’].data == True , it complains saying dict does not have results attribute !
Here result is my registered variable. As per above response , it should work fine ?

‘data’ is inside ‘content’ you might want to check around that

Thanks Abhijeet ! I tried even result[‘results’][0].content.data but still it complains results is not dict attribute !

Try by removing quotes

result[results][0].content.data

No even it complains results is not defined !

I am not understanding whats wrong here :
Here is the task:

  • name: print boss
    debug:
    msg: " {{ result }}"

and output is:
ok: [node-1] => {
“msg”: " {‘msg’: u’All items completed’, ‘changed’: False, ‘results’: [{‘ansible_loop_var’: u’item’, ‘failed’: False, ‘changed’: False, u’content’: {u’body’: None, u’node’: u’node-1’, u’isFetched’: True, u’appServer’: u’1’, u’type’: u’appServerFullStatus’, u’allServicesEnabled’:

I need to reach upto isFetched in this json ?

Notice, result is registered with loop ! So wanted to check in case of loop does registered variable contains result of each iteration ?

I have a task output like this:
- name: Print Response of status resource
  debug:
    msg: " {{ result }}"

ok: [node-3] => {
    "msg": " {'msg': u'All items completed', 'changed': False, 'results':
[{'ansible_loop_var': u'item', 'failed': False, 'changed': False,
u'content': {u'body': None, u'node': u'node-3', u'allServicesLocked': True,
u'appServer': u'1', u'type': u'iMIME', u'data': True,]} "
}

Use "yaml" callback plugin when you want to see complex structures. For
example, this task

  - debug:
      var: result

would give

  > ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook test.yml

  result:
    changed: false
    msg: All items completed
    results:
    - ansible_loop_var: item
      changed: false
      content:
        allServicesLocked: true
        appServer: '1'
        body: None
        data: true
        node: node-3
        type: iMIME
      failed: false

Then, it's easier to find an expression which you're probably looking for

  - debug:
      var: result.results.0.content.data

HTH,

  -vlado

THanks Vlad !
I will use same !

Regards
Rahul