Hi [email protected]
Here is the verbose output
root@Raspi_Ctrl:/ansible/playbook# ansible-playbook batch.yml -vvvv -i
/ansible/hosts
ansible-playbook 2.5.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules']
ansible python module location =
/usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0
20170124]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from
/usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
PLAYBOOK: batch.yml
************************************************************
1 plays in batch.yml
PLAY [test script module]
******************************************************
TASK [Gathering Facts]
*********************************************************
Using module file
/usr/local/lib/python2.7/dist-packages/ansible/modules/windows/setup.ps1
<100.> ESTABLISH WINRM CONNECTION FOR USER: user on PORT 5986 TO 100.
EXEC (via pipeline wrapper)
ok: [100.]
META: ran handlers
TASK [run simple script]
*******************************************************
*task path: /ansible/playbook/batch.yml:5*
Using module file
/usr/local/lib/python2.7/dist-packages/ansible/modules/windows/win_command.ps1
<100.> ESTABLISH WINRM CONNECTION FOR USER: user on PORT 5986 TO 100.
EXEC (via pipeline wrapper)
fatal: [100.]: FAILED! => {
"changed": true,
"cmd": "C:\\Users\\user\\Desktop\\configure_builder.bat",
"delta": "0:00:00.364026",
"end": "2017-11-09 03:53:27.958887",
"msg": "non-zero return code",
"rc": 1,
"start": "2017-11-09 03:53:27.594860",
"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\\user>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\\user>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=
On Wed, Nov 8, 2017 at 10:53 AM, Zimidar Boy <[email protected]> wrote:
> Also try this batch file. *https://gist.github.com/wjrogers/1016065
> <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 a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/5F3UCDR3j_Y/unsubscribe.
> To unsubscribe from this group and all its topics, 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
> <https://groups.google.com/d/msgid/ansible-project/7bfc2e99-19bf-471d-9ce6-5769d9974475%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
Thank you,
Larry Pescatore
Lab Engineer, ERG Inc. @ Google
--
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/CADxK1ksihWqfocJBvMAVHyGX96bUkv2NNdaFvxdeh8uMg92%2BkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.