I am attempting to display the debug output of multiple items from a 
previous resource(including as complete an example as possible; not using 
roles for this):

---
- hosts:
  - sled1
  gather_facts: false

  tasks:
  - name: verify ssh from sled1 to all other sleds
    shell: ssh {{ item }} 'hostname; uptime'
    register: ssh_other_sleds
    changed_when: False
    with_items:
    - sled2
    - sled3


  - name: ssh sled1 to other sleds output
    debug: 
      msg: "{{ item.stdout }}"
    with_items: ssh_other_sleds.results


 I always get a lot more than I'm asking for: 

TASK: [ssh sled1 to other sleds output] 
***************************************
ok: [sled1] => (item={u'cmd': u"ssh sled2 'hostname; uptime'", u'end': 
u'2015-04-23 
20:58:58.918795', u'stderr': u'', u'stdout': u'sled2\n 20:58:58 up 290 
days,  6:08,  0 users,  load average: 0.45, 0.31, 0.25', u'changed': False, 
u'rc': 0, 'item': 'sled2', u'warnings': [], u'delta': u'0:00:03.241817', 
'invocation': {'module_name': u'shell', 'module_args': u"ssh sled2 
'hostname; uptime'"}, 'stdout_lines': [u'sled2', u' 20:58:58 up 290 days, 
 6:08,  0 users,  load average: 0.45, 0.31, 0.25'], u'start': u'2015-04-23 
20:58:55.676978'}) => {
    "item": {
        "changed": false,
        "cmd": "ssh sled2 'hostname; uptime'",
        "delta": "0:00:03.241817",
        "end": "2015-04-23 20:58:58.918795",
        "invocation": {
            "module_args": "ssh sled2 'hostname; uptime'",
            "module_name": "shell"
        },
        "item": "sled2",
        "rc": 0,
        "start": "2015-04-23 20:58:55.676978",
        "stderr": "",
        "stdout": "sled2\n 20:58:58 up 290 days,  6:08,  0 users,  load 
average: 0.45, 0.31, 0.25",
        "stdout_lines": [
            "sled2",
            " 20:58:58 up 290 days,  6:08,  0 users,  load average: 0.45, 
0.31, 0.25"
        ],
        "warnings": []
    },
    "msg": "sled2\n 20:58:58 up 290 days,  6:08,  0 users,  load average: 
0.45, 0.31, 0.25"
}
ok: [sled1] => (item={u'cmd': u"ssh sled3 'hostname; uptime'", u'end': 
u'2015-04-23 
20:59:12.573667', u'stderr': u'', u'stdout': u'sled3\n 20:59:12 up 290 
days,  6:09,  0 users,  load average: 0.29, 0.24, 0.23', u'changed': False, 
u'rc': 0, 'item': 'sled3', u'warnings': [], u'delta': u'0:00:03.323545', 
'invocation': {'module_name': u'shell', 'module_args': u"ssh sled3 
'hostname; uptime'"}, 'stdout_lines': [u'sled3', u' 20:59:12 up 290 days, 
 6:09,  0 users,  load average: 0.29, 0.24, 0.23'], u'start': u'2015-04-23 
20:59:09.250122'}) => {
    "item": {
        "changed": false,
        "cmd": "ssh sled3 'hostname; uptime'",
        "delta": "0:00:03.323545",
        "end": "2015-04-23 20:59:12.573667",
        "invocation": {
            "module_args": "ssh sled3 'hostname; uptime'",
            "module_name": "shell"
        },
        "item": "sled3",
        "rc": 0,
        "start": "2015-04-23 20:59:09.250122",
        "stderr": "",
        "stdout": "sled3\n 20:59:12 up 290 days,  6:09,  0 users,  load 
average: 0.29, 0.24, 0.23",
        "stdout_lines": [
            "sled3",
            " 20:59:12 up 290 days,  6:09,  0 users,  load average: 0.29, 
0.24, 0.23"
        ],
        "warnings": []
    },
    "msg": "sled3\n 20:59:12 up 290 days,  6:09,  0 users,  load average: 
0.29, 0.24, 0.23"
}


After searching around a while, I have tried things like: 

      msg: "{{ item[0].stdout }}"


or

      msg: "{{ item['item'][0]['stdout'] }}"


all to no avail.  

-- 
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/aa9cc27d-c55a-4de3-a301-dac89abae425%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to