Hi -  I'm looking for a way to unarchive an array of files and want to use 
different 'creates' checks for each.

------Vars-------
sources :
- WAS_V8.5.5_1_OF_3.zip
- WAS_V8.5.5_2_OF_3.zip
- WAS_V8.5.5_3_OF_3.zip

------Tasks------
- name: unarchive source to target
  sudo: yes
  unarchive: src={{ item }} dest=/opt/WAS_{{ version }} copy=yes 
creates=/opt/WAS_{{ version }}/disk{{ item.index|int +1 }}/diskTag.inf
  with_items: "{{ sources }}"

The above code is trying to check for a file ..../disk1/diskTag.inf for the 
first entry in the array, ...../disk2/diskTag.inf for the second and so on. 
While the unarchive does seem to loop on the src correctly the creates 
always references the item with index 0. Trace output below. Any thoughts 
on if this is possible in Ansible. My fallback is an unarchive per entry 
but its not ideal.

ok: [10.108.122.113] => (item=WAS_V8.5.5_1_OF_3.zip) => {"changed": false, 
"item": "WAS_V8.5.5_1_OF_3.zip", "msg": "skipped, since 
/opt/WAS_8.5.5/disk1/diskTag.inf exists"}
ok: [10.108.122.113] => (item=WAS_V8.5.5_2_OF_3.zip) => {"changed": false, 
"item": "WAS_V8.5.5_2_OF_3.zip", "msg": "skipped, since 
/opt/WAS_8.5.5/disk1/diskTag.inf exists"}
ok: [10.108.122.113] => (item=WAS_V8.5.5_3_OF_3.zip) => {"changed": false, 
"item": "WAS_V8.5.5_3_OF_3.zip", "msg": "skipped, since 
/opt/WAS_8.5.5/disk1/diskTag.inf exists"}

-- 
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/150f37b1-46d2-4549-9697-7f9fdc25d1e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to