How to force win_unzip to overwrite a existing file?

409 views
Skip to first unread message

Daniel Bernardo

unread,
Jan 18, 2018, 2:42:04 PM1/18/18
to Ansible Project
I'm extrating a zip file on a folder, like to do a IIS deploy using win_unzip, but files that alredy exists were no updated.

I didnt found nothing about =/

http://docs.ansible.com/ansible/latest/win_unzip_module.html

Jordan Borean

unread,
Jan 18, 2018, 6:49:44 PM1/18/18
to Ansible Project
This is definitely not the case for me, looking at the code there is no checksum verification of files and it will always overwrite the existing file if it already exists. The only exception to this rule is if you use the creates argument where it won't even run any extraction if the path already exists.

Might be best to check that the contents of the 2 zip files are either the same or different as 2.3 to 2.5 (devel) all overwrite on extraction.

Thanks

Jordan

J Hawkesworth

unread,
Jan 23, 2018, 2:54:58 AM1/23/18
to Ansible Project
If it makes sense for what you are doing, you can allways make sure that the zip is removed by running a win file state: absent first, like this.

- name: ensure old zip is removed
  win_file:
    state: absent
    path: C:\path\to\zipfile.zip
Reply all
Reply to author
Forward
0 new messages