Following codes should work.
---
- name: check file exists
stat:
path: some/relative/path/{{ item }}
with_items:
- some
- other
register: checks
- name: Copying webcontent
synchronize:
src: some/relative/path/{{ item }}
dest: /some/absolute/path/{{ item }}
when: item.stat.exists
with_items: "{{ checks.results }}"
On Sunday, August 16, 2015 at 2:28:24 AM UTC+7, Robert Arnonym wrote:
>
> Hello
>
> i have the following task:
>
> - name: Copying webcontent
> synchronize: src=some/relative/path/{{ item }}
> dest=/some/absolute/path/{{ item }}
> with_items:
> - some
> - other
>
> what i need:
> "other" does not exist locally and thats ok. How can i check, if the items
> exist locally and skip the cycle if not?
>
> Thx
>
--
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/308a1534-51ef-4995-b1b9-d888625017e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.