Need to verify this is really a bug

70 views
Skip to first unread message

Michael Baydoun

unread,
Apr 24, 2014, 2:03:52 PM4/24/14
to ansible...@googlegroups.com
Small playbook that reproduces behavior https://gist.github.com/IndyMichaelB/11263577
First comment shows the output

Serge van Ginderachter

unread,
Apr 24, 2014, 2:07:53 PM4/24/14
to ansible...@googlegroups.com
with fistvar you use that list of lines, so
secondvar is the registered output of a loop, which means you have "several sets of results"

change
debug: var=secondvar.stdout_lines
to
debug: var=secondvar.results.stdout_lines


HTH,


Serge


On 24 April 2014 20:03, Michael Baydoun <indymi...@gmail.com> wrote:
Small playbook that reproduces behavior https://gist.github.com/IndyMichaelB/11263577
First comment shows the output

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CADgbg8JJ0nSut%3DEFiexZWrWC3LvSWY8nWL1HJPKuCerA9GK2_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Marc Petrivelli

unread,
Apr 24, 2014, 2:10:04 PM4/24/14
to ansible...@googlegroups.com

Michael Baydoun

unread,
Apr 24, 2014, 2:12:46 PM4/24/14
to ansible...@googlegroups.com
I get the same results after making the suggested change


Michael Baydoun

unread,
Apr 24, 2014, 2:18:00 PM4/24/14
to ansible...@googlegroups.com
If I debug all of secondvar I can see the output I want, and it looks like it should be contained in secondvar.results.stdout, but if I try to debug seconvar.results.stdout I only get 

"secondvar.results.stdout": "{{ secondvar.results.stdout }}"

Matt Martz

unread,
Apr 24, 2014, 2:38:06 PM4/24/14
to Michael Baydoun, ansible...@googlegroups.com
secondvar.results is a list of dictionaries, that has keys like 'stdout' and 'stdout_lines'

So secondvar.results[0].stdout would give you the stdout of the first iteration

If you are looking to again loop over all items in stdout_lines for each iteration, you need to do something like

  - debug: var=item
    with_flattened: secondvar.results|map(attribute='stdout_lines')|list
-- 
Matt Martz
ma...@sivel.net

Serge van Ginderachter

unread,
Apr 24, 2014, 2:40:32 PM4/24/14
to ansible...@googlegroups.com
My apologies, I was too quick and very mistaken:

change
debug: var=secondvar.stdout_lines
to
​​
debug: var=secondvar.results.stdout_lines

Should be


- name: test | should display directory contents but does not
debug: var=item.stdout
with_items: secondvar.results


Noting this by heart, so hopefully not mistaken this time :-)


Serge

Michael Baydoun

unread,
Apr 24, 2014, 3:09:06 PM4/24/14
to ansible...@googlegroups.com
Thanks all!  I figured it was user error and not a bug :)



--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Michael DeHaan

unread,
Apr 24, 2014, 3:29:07 PM4/24/14
to ansible...@googlegroups.com
Please include some English description about a problem when posting to this list as well.

It's helpful to understand what you want and so forth without having to read it all and mentally compile ansible in my head.






On Thu, Apr 24, 2014 at 2:03 PM, Michael Baydoun <indymi...@gmail.com> wrote:
Small playbook that reproduces behavior https://gist.github.com/IndyMichaelB/11263577
First comment shows the output

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages