Why can’t Ansible find an executable that’s in the system path?

  7zip, ansible, windows

Ansible v2.11
Target: Windows 2012 Server

I’m trying to unzip a file using the C:Program Files-zipz.exe utility, and that folder is in the system path. I can’t use win_unzip because of long file names. However I get this?

- name: "Unzip exa-web {{ exa_web_zip }}"
  win_command:
    7z x {{ remote_dir }}/{{ exa_web_zip }} -o{{ exa_web_dir }}

TASK [exa-web : Unzip exa-web exa-web-development-b7cf4eee3c-20210930_1700-win64.zip] ***
fatal: [172.16.100.31]: FAILED! => {"changed": false, "cmd": "7z x C:temp/exa-web-development-b7cf4eee3c-20210930_1700-win64.zip -oC:ViztekEXAweb", "msg": "Exception calling "SearchPath" with "1" argument(s): "Could not find file '7z.exe'."", "rc": 2}

I even added this task just to ensure that is is in the system path, to no avail.

- name: Add to system path
  win_path:
    elements:
      - "C:Program Filse7-zip"

What am I missing?

Source: Windows Questions

LEAVE A COMMENT