Reputation: 10917
- name: download files from s3 but dont download if the file checksums match
s3: bucket=bname object=/file.gz dest=/opt/tmp/file.gz mode=get
Above snippet works correctly and pulls the file. gz from s3 and places it on /opt/tmp/ location
But if i am going to rerun the above task (when the file is already downloaded once and is present at /opt/tmp/), It is throwing the error -
msg: Files uploaded with multipart of s3 are not supported with checksum, unable to compute checksum.
I tried to use overwrite=different
# GET an object but dont download if the file checksums match
s3: bucket=bname object=/file.gz dest=/opt/tmp/file.gz mode=get overwrite=different
But i am getting the error -
msg: Boolean different not in either boolean list
Any workaround or suggestion on how i can make sure that i can rerun the task without worry will help, Thanks.
Upvotes: 2
Views: 1346
Reputation: 10917
- shell: if [[ -f "/opt/tmp/file.gz" ]]; then /bin/true; else /bin/false; fi
register: result
ignore_errors: True
- name: download files from s3 but dont download if the file exists
s3: bucket=bname object=/file.gz dest=/opt/tmp/file.gz mode=get
when: result|failed
Workaround - Checking the file is present or not, Skip - if the file is present and download - if it is not present.
https://github.com/ansible/ansible/issues/5442 explains similar issue
Upvotes: 2