Ansible script to install .exe file on windows with interactive mode

I am trying to install .exe file but win_shell or win_command is running the installer indefinightly. The exe installation requirs to feed instaructions during installation, like language : english, select a check box, next and finish etc. How can I achieve it with ansible script. Thanks a lot for your support.

Try using the expect module?

1 Like

Not always, but many Windows installers can install non-interactively by providing all of the answers it needs at runtime. This might mean passing them all as arguements/parameters, or providing an answers file. Sometimes an exe is just a wrapper around an msi installer, which can be extracted and more easily installed since MSI is easy to automate.

There’s even a possibility that the install is already automated by Chocolatey, and you could leverage the Chocolatey.Chocolatey collection.

Can you tell us what program you’re actually trying to install?

3 Likes

Thank you all for your quick response.
No, I have not tried with expect module nor with chocolatey package for this exe installation. Will try and update here.
However I have made it work with creating a ‘ini’ file with all the interactive command and referring it from the ansible script.
Command:

  • name: install gpg4win-3.1.5.exe
    win_command: D:\gpg4win-3.1.5.exe /S /C=D:\gpg4win.ini /D=D:\Gpg4win
    both the .exe file and ‘ini’ file inside ‘D:/’ drive.
    If anyone has any better solution, please share. Thank you.