I got a code which check whether local file exists based on with_items and keeps result in array
now based on this array i have to copy the local file to remote dir again using loop
- name: check wheter we have local copy plan xml file
local_action: stat path=“{{local_artifacts }}/{{ item.0 }}/plan/plan.xml”
with_together: - “{{ env[domain].artifact_names }}”
register: result
Here my results go into array, based on this result.results i want to copy the plan.xml
-
name: copy deployment plan
copy:
src=“{{local_artifacts }}/{{ item.0 }}/plan/plan.xml”
dest=“{{ domain_application_home }}/{{ item.0 }}/plan/plan.xml”
with_together: -
“{{ env[domain].artifact_names }}”
when: result.results[0].stat.exists
at the moment this code works, but it always checks the first result.results stat, but if if want to iterate thru this result.results, how is it possible?
Can some help me please.