diff --git a/lib/ansible/modules/network/basics/get_url.py b/lib/ansible/modules/network/basics/get_url.py index 5e2fed2fa20..d79cfe2b133 100644 --- a/lib/ansible/modules/network/basics/get_url.py +++ b/lib/ansible/modules/network/basics/get_url.py @@ -253,7 +253,6 @@ def extract_filename_from_headers(headers): # main def main(): - argument_spec = url_argument_spec() argument_spec.update( url = dict(required=True), @@ -310,7 +309,6 @@ def main(): except ValueError: module.fail_json(msg="The checksum parameter has to be in format :") - if not dest_is_dir and os.path.exists(dest): checksum_mismatch = False @@ -326,7 +324,15 @@ def main(): # Not forcing redownload, unless checksum does not match if not force and not checksum_mismatch: - module.exit_json(msg="file already exists", dest=dest, url=url, changed=False) + # allow file attribute changes + module.params['path'] = dest + file_args = module.load_file_common_arguments(module.params) + file_args['path'] = dest + changed = module.set_fs_attributes_if_different(file_args, False) + + if changed: + module.exit_json(msg="file already exists but file attributes changed", dest=dest, url=url, changed=changed) + module.exit_json(msg="file already exists", dest=dest, url=url, changed=changed) # If the file already exists, prepare the last modified time for the # request.