Hi

I have the following in my playbook

- hosts: localhost
  tasks:
    - name: echo output
      command: echo {{item}}
      register: echo_output
      with_items:
         - hi
         - hello

    
    - debug: msg="{{ echo_output.results}}"
    
 
When I run this playbook, I am getting the following

RES1SMOHANAS-M1:ansible-portal_platform smohanasundaram$ ansible-playbook 
-i inventory/sriDev.ini -c local 
portal_platform_liferay_patches_prestage.yml
 [WARNING]: The `prettytable` python module is not installed. Disabling the
HipChat callback plugin.

 [WARNING]: HipChat token could not be loaded. The HipChat token can be
provided using the `HIPCHAT_TOKEN` environment variable.


PLAY [localhost] 
**************************************************************

GATHERING FACTS 
***************************************************************
ok: [127.0.0.1]

TASK: [echo output] 
***********************************************************
changed: [127.0.0.1] => (item=hi)
changed: [127.0.0.1] => (item=hello)

TASK: [debug msg="{{ echo_output.results}}"] 
**********************************
ok: [127.0.0.1] => {
    "msg": "[{u'stdout': u'hi', u'changed': True, u'end': u'2016-04-28 
10:14:19.487867', u'start': u'2016-04-28 10:14:19.465853', u'cmd': 
[u'echo', u'hi'], u'rc': 0, 'item': 'hi', u'stderr': u'', u'delta': 
u'0:00:00.022014', 'invocation': {'module_name': u'command', 'module_args': 
u'echo hi'}, u'warnings': []}, {u'stdout': u'hello', u'changed': True, 
u'end': u'2016-04-28 10:14:19.710345', u'start': u'2016-04-28 
10:14:19.688217', u'cmd': [u'echo', u'hello'], u'rc': 0, 'item': 'hello', 
u'stderr': u'', u'delta': u'0:00:00.022128', 'invocation': {'module_name': 
u'command', 'module_args': u'echo hello'}, u'warnings': []}]"
}

TASK: [debug msg="{{ echo_output.results|map(attribute='stdout')|list}}"] 
*****
ok: [127.0.0.1] => {
    "msg": "[u'hi', u'hello']"
}

TASK: [debug msg="{{ 
echo_output.results|map(attribute='stdout_lines')|list}}"] ***
ok: [127.0.0.1] => {
    "msg": "[Undefined, Undefined]"
}

PLAY RECAP 
********************************************************************
127.0.0.1                  : ok=5    changed=1    unreachable=0    failed=0
'

Looks like stdout_lines is not present in the "echo_output.results". Please 
let me know what could be wrong here.

Thanks
Sri

-- 
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/5bd07783-4300-4dcf-8d26-041e94cc2508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to