Also try this batch file. *https://gist.github.com/wjrogers/1016065*
On Wednesday, November 8, 2017 at 1:23:57 PM UTC-5, [email protected] wrote: > > HI folks, > I have copied a batch file from ansible to windows and want to run it. > If i go to the windows machine and run it it works fine, but when I run it > from playbook it fails. > > Here is the playbook: > > > --- > > - name: test script module > > hosts: builders > > tasks: > > - name: run simple script > > win_command: C:\Users\pkmbuilder\Desktop\configure_builder.bat > > > > > And here is the batch: > > ::Install cygwin > > setup-x86_64.exe --root C:\cygwin64 --quiet-mode --site > http://cygwin.mirror.constant.com --packages "openssh,rsync,zip,vim,wget" > || exit /b 1 > > > When running via cli I get > > > root@Raspi_Ctrl:/ansible/playbook# ansible-playbook > /ansible/playbook/batch.yml -i /ansible/hosts > > > PLAY [test script module] > ****************************************************** > > > TASK [Gathering Facts] > ********************************************************* > > ok: [100.] > > > TASK [run simple script] > ******************************************************* > > fatal: [100.6]: FAILED! => {"changed": true, "cmd": > "C:\\Users\\pkmbuilder\\Desktop\\configure_builder.bat", "delta": > "0:00:00.304048", "end": "2017-11-09 02:22:46.953264", "msg": "non-zero > return code", "rc": 1, "start": "2017-11-09 02:22:46.649216", "stderr": > "'setup-x86_64.exe' is not recognized as an internal or external > command,\r\noperable program or batch file.\r\n", "stderr_lines": > ["'setup-x86_64.exe' is not recognized as an internal or external > command,", "operable program or batch file."], "stdout": > "\r\nC:\\Users\\pkmbuilder>setup-x86_64.exe --root C:\\cygwin64 > --quiet-mode --site http://cygwin.mirror.constant.com --packages > \"openssh,rsync,zip,vim,wget\" || exit /b 1 \r\n", "stdout_lines": ["", > "C:\\Users\\pkmbuilder>setup-x86_64.exe --root C:\\cygwin64 --quiet-mode > --site http://cygwin.mirror.constant.com --packages > \"openssh,rsync,zip,vim,wget\" || exit /b 1 "]} > > to retry, use: --limit @/ansible/playbook/batch.retry > > > PLAY RECAP > ********************************************************************* > > 100. : ok=1 changed=0 unreachable=0 failed=1 > > > What variables need I set to get this running? > > > Thanks! > > > > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7bfc2e99-19bf-471d-9ce6-5769d9974475%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
