@ -257,29 +257,53 @@
- result is changed
- "stat_result.stat.mode == '0775'"
- name : Get a file that already exists
- name : test checksum match in check mode
get_url:
url : 'https://{{ httpbin_host }}/get'
dest : '{{ remote_tmp_dir }}/test'
checksum : 'sha256:7036ede810fad2b5d2e7547ec703cae8da61edbba43c23f9d7203a0239b765c4.'
check_mode : True
register : result
- name : Assert that check mode was green
assert:
that:
- result is not changed
- name : Get a file that already exists with a checksum
get_url:
url : 'https://{{ httpbin_host }}/cache'
dest : '{{ remote_tmp_dir }}/test'
checksum : 'sha1:{{ stat_result.stat.checksum }}'
register : result
- name : Assert that the file was not downloaded
assert:
that:
- result.msg == 'file already exists'
- name : Get a file that already exists
get_url:
url : 'https://{{ httpbin_host }}/cache'
dest : '{{ remote_tmp_dir }}/test'
register : result
- name : Assert that we didn't re-download unnecessarily
assert:
that:
- result is not changed
- "'304' in result.msg"
- name : test checksum match in check mode
- name : get a file that doesn't respond to If-Modified-Since without checksum
get_url:
url : 'https://{{ httpbin_host }}/get'
dest : '{{ remote_tmp_dir }}/test'
checksum : 'sha256:7036ede810fad2b5d2e7547ec703cae8da61edbba43c23f9d7203a0239b765c4.'
check_mode : True
register : result
- name : Assert that check mode was green
- name : Assert that we downloaded the file
assert:
that:
- result is not changed
- result is changed
# https://github.com/ansible/ansible/issues/27617