Hi,

did you already solve your problem?

On 11.01.17 12:08 Miguel David wrote:

> And on the tasks main.yml
> 
> - name: do stuff
>   file: path=/var/www/html/{{ item.name }} state=directory
>   with_items: "{{ services }}"
>   when: type == "bar" and item.foo == "bar"

Normally this should be "split" up into as many separate tasks as you
have services in {{ services }}. Each one is run evaluating the
when-conditition. So one of them should work...

https://docs.ansible.com/ansible/playbooks_loops.html
> Also be aware that when combining when with with_items (or any other loop 
> statement), the when statement is processed separately for each item. See The 
> When Statement for an example.

https://docs.ansible.com/ansible/playbooks_conditionals.html#the-when-statement

Try to debug this using the debug task, drop the type in when and see,
what works:

  - debug: msg="Works with {{ item.name }}"
    when: 'item.foo == "bar"'

Johannes

-- 
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/78234465-e4f1-e686-c12e-6be4bbae2170%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to