ansible untar a file on a windows target

  ansible, tar, windows

I have been trying to untar a file .tar with ansible on a windows target using module "win_unzip" below and it doesn’t work.

That module "win_unzip" works fine to unzip of course .zip files


- name: Unzip fichero
  community.windows.win_unzip:
    src:  /some_user/test-ansible/fake_package.tar
    dest: /some_user/test-ansible/

ERROR MSG
The msg displays that PSCX is needed but it is already there, otherwise "win_unzip" won’t work with .zip files.

TASK [Unarchive a file that is already on the remote machine] *********************************************************************************************************************
fatal: [wintrg-01]: FAILED! => {"changed": false, "dest": "C:Userssome_userDesktop", "msg": "PowerShellCommunityExtensions PowerShell Module (PSCX) is required for non-'.zip' compressed archive types.", "removed": false, "src": "C:Userssome_userDesktopfake_package.tar"}

I think that maybe I would need to install 7zip in the windows target and use ansible module "win_shell" to untar the required file.

Are you aware of any ansible community module that can do this?.

Source: Windows Questions

LEAVE A COMMENT