Distinguish zj_source and zj_result and item

The inner item needs to be zj_source. Call the outer zj_result
for clarity.

Change-Id: Ic5a7b18e1dba71d8dffa171246b52c81e30c6d8f
This commit is contained in:
Albin Vass 2020-05-01 22:27:50 +02:00 committed by Monty Taylor
parent 10cd19fdae
commit 61c4eeaffd

View File

@ -33,15 +33,15 @@
# which is handled here).
- name: Set source and destination for files and folders
set_fact:
source: "{{ zj_source.stat.path }}"
dest: "{{ zj_source.item.value.split('_')[0] }}/{{ zj_source.stat.path|basename|regex_replace('^(\\..*)$', '_\\1') }}{% if zj_source.item.value.endswith('_txt') %}.txt{% endif %}"
type: "{{ zj_source.item.value.split('_')[0] }}"
source: "{{ zj_result.stat.path }}"
dest: "{{ zj_result.zj_source.value.split('_')[0] }}/{{ zj_result.stat.path|basename|regex_replace('^(\\..*)$', '_\\1') }}{% if zj_result.zj_source.value.endswith('_txt') %}.txt{% endif %}"
type: "{{ zj_result.zj_source.value.split('_')[0] }}"
with_items: "{{ sources.results }}"
loop_control:
loop_var: zj_source
loop_var: zj_result
when:
- zj_source.stat.exists
- zj_source.item.value
- zj_result.stat.exists
- zj_result.zj_source.value
register: results
no_log: true