I don’t think win_shell is necessary, you are truly trying to run an executable and don’t want to confuse issues that may be related to how the shell handles things and how a command handles it. In your case you will need to enclose the full command with a single quote ', you tried this but I think forgot to close the string with a ’ hence Ansible telling you that there was inbalanced quotes. I just tried the following on a brand new server and it was successful in install Cygwin.
-
hosts: ‘2012R2’
gather_facts: no
tasks: -
name: download Cygwin installer
win_get_url:
url: https://cygwin.com/setup-x86_64.exe
dest: C:\temp\setup-x86_64.exe -
name: install Cygwin
win_command: ‘C:\temp\setup-x86_64.exe --root C:\cygwin64 --quiet-mode --site http://cygwin.mirror.constant.com --packages “openssh,rsync,zip,vim,wget,nano”’
As you can see, the whole string for win_command is enclosed with ’ and it has allowed me to continue to use " and \ without escaping anything. Here you can see Cygwin is installed and up and running
Thanks
Jordan