win_command installing application on window machine

170 views
Skip to first unread message

Cindy Lee

unread,
Aug 2, 2017, 9:58:29 PM8/2/17
to Ansible Project
Hi, 
I have some problems using Ansible with Windows
I'm trying to install program to the window with win_command. 

Below is the part of the playbook which causes an issue.  

==================================================
    - name: install an application
      win_command: '"C:\Program Files (x86)\application.exe" -s'

===================================================

cmd is for silent install. and this application requires to reboot and there is no way of not to restart the window. (/norestart doesn't work on this application.)
And before even boots up get the following message:


TASK [install an application] *********************************************************************************************
fatal: [WIN_IP]: FAILED! => {"changed": true, "cmd": "\"C:\\Program Files (x86)\\application.exe\" -s", "delta": "0:03:54.187611", "end": "2017-08-03 01:27:44.137300", "failed": true, "rc": 3, "start": "2017-08-03 01:23:49.949689", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
        to retry, use: --limit @/etc/ansible/install.retry

After the reboot, I see that application was successfully installed but on the ansible side it throws out an error and playbook stop. 

since the message does not throw anything out, cannot tell what is an issue. 

Any ideas/help?

Thanks in advance!

Jordan Borean

unread,
Aug 3, 2017, 1:29:04 AM8/3/17
to Ansible Project
Hey Cindy

You look at using win_package to install your exe, the only downside is that you need to know the product id of the application to run the task. Details on the module are at http://docs.ansible.com/ansible/latest/win_package_module.html, there are also some examples on that page to show you how it works with exe's.

As for why it is failing in win_command it is probably due to the space in the path, Windows doesn't play nicely with them. One thing I would try is use single quotes instead of double  as well as looking at the application docs as to what an RC of 3 means.

Thanks

Jordan
Reply all
Reply to author
Forward
0 new messages