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.

Reply via email to