Search code examples
windowsansiblecommandansible-2.xansible-inventory

Ansible Error for windows cmd "start" for installing exe file


Hello I am trying to install conda on remote windows server that do not have access to internet hence I am trying to copy the exe file to the server and then install. In windows I use 'start' command but with ansible I am getting the error as follow:

Could not find the file start.exe

My windows cmd is:

start /wait "" \\projects\tools\anaconda3.exe /InstallType= AllUsers /AddToPath=1 /S /D=D:\anaconda

my playbook:

- name : 'install anaconda'
win_command : 'start /wait "" \\projects\tools\anaconda3.exe /InstallType= AllUsers /AddToPath=1 /S /D=D:\anaconda'
args:
  chdir: 'D:\'

How to make ansibe recognize the 'start'


Solution

  • try using win_shell and specifying cmd as the executable :

    - name : install anaconda
      win_shell : start /wait anaconda3.exe /InstallType=AllUsers /AddToPath=1 /S /D=D:\anaconda
      args:
        chdir: D:\projects\tools\
        executable: cmd