Nothing fishy at all - there is an optimization for certain modules
(primarily apt and yum) where items are combined into a single execution.
This makes these modules way more efficient, since the underlying package
management systems are able to handle a list of package names at once just
as easily.

But yes, the bug appears to be that some later conditional check is
incorrectly being evaluated to make the task be skipped rather than run. As
Matt mentioned above, there is a per-item check with the conditional to
remove individual items, which I *believe* should be the only conditional
check when the items have been merged into a list like this.

On Thu, Oct 2, 2014 at 1:09 PM, Josh Smift <j...@care.com> wrote:

> JC> Yes, here's a simple reproducer:
> JC>
> JC> - hosts: localhost
> JC>   gather_facts: no
> JC>   vars:
> JC>     test: ['a', 'b']
> JC>   tasks:
> JC>   - shell: echo -e 'a\nb\nc'
> JC>     register: result
> JC>   - debug: var=result
> JC>   - name: do it
> JC>     yum: name="{{item}}"
> JC>     with_items: result.stdout_lines
> JC>     when: item in test
> JC>
> JC> The output of the "do it" task is:
> JC>
> JC> TASK: [do it]
> JC> *****************************************************************
> JC> skipping: [127.0.0.1] => (item=a,b)
>
> This seems fishy to me. Wouldn't you expect an item=a and an item=b line?
> Does item=a,b imply that it's checking to see if the string "a,b" is in
> test (which it isn't)?
>
> Indeed, if you replace 'yum: name="{{item}}"' with 'debug: var=item, you
> get different results:
>
>   TASK: [do it]
> *****************************************************************
>   ok: [localhost] => (item=a) => {
>       "item": "a"
>   }
>   ok: [localhost] => (item=b) => {
>       "item": "b"
>   }
>   skipping: [localhost] => (item=c)
>
> Is it surprising that debug treats the items as a list elements, but yum
> treats them as a comma-separated string of elements?
>
>                                       -Josh (j...@care.com)
>
>
>
> This email is intended for the person(s) to whom it is addressed and may
> contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized
> use, distribution, copying, or disclosure by any person other than the
> addressee(s) is strictly prohibited. If you have received this email in
> error, please notify the sender immediately by return email and delete the
> message and any attachments from your system.
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/21549.38122.295125.36977%40gargle.gargle.HOWL
> .
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to