Not sure why you're using ssh/Python to talk to Windows- you *might* be 
able to get it to work, but the native Windows management transport that 
Ansible supports is Powershell over WinRM. 

"shell" is still a module, so it requires that Ansible's basic.py module 
API and the shell module code itself are functional on the target machine 
(which is not tested, and clearly has issues). 

If you really want to use SSH to just run commands on Windows/cygwin, just 
do raw: (whatever command)- that won't subject you to any Python 
requirements on the Windows side. But if you're really going to use Ansible 
the way it was intended, light up WinRM and use the native Windows 
transport and modules that actually get tested.

On Friday, October 14, 2016 at 6:48:32 AM UTC-7, Sam Brelsfoard wrote:
>
> All I'm trying to do is run a shell command though. Am I approaching this 
> wrong?
> Here's my playbook:
>
> ---
> - hosts: samtestwin
>   gather_facts: false
>   tasks:
>     - name: get server.db from devopscoms
>       shell: mv devopscoms/server.db ~/server.db
>
>
>
> On Thursday, October 13, 2016 at 2:24:33 PM UTC-4, Matt Davis wrote:
>>
>> Running python modules on Windows isn't supported or tested (and in most 
>> cases just plain won't work)- would strongly suggest you find a win_ 
>> equivalent to whatever you're trying to do...
>>
>> On Thursday, October 13, 2016 at 11:17:53 AM UTC-7, Sam Brelsfoard wrote:
>>>
>>> I've seen a couple of other folks have this issue, but I've not found 
>>> any answers/solutions. 
>>>
>>> I have a playbook that runs fine from an ansible server (CentOS) to a 
>>> Mac OSX node, however, when I run the same playbook against a Windows node 
>>> I get an ImportError. Any thoughts?
>>> example:
>>>
>>> ansible-playbook playbooks/getserverdb.yml -vvv
>>> Using /etc/ansible/ansible.cfg as config file
>>> PLAYBOOK: getserverdb.yml 
>>> ******************************************************
>>> 1 plays in playbooks/getserverdb.yml
>>> PLAY [samtestwin] 
>>> **************************************************************
>>> TASK [get server.db from devopscoms] 
>>> *******************************************
>>> task path: /etc/ansible/playbooks/getserverdb.yml:5
>>> <sbrelsfoard-pc> ESTABLISH SSH CONNECTION FOR USER: izodev
>>> <sbrelsfoard-pc> SSH: EXEC sshpass -d12 ssh -C -q -o ControlMaster=no -o 
>>> User=izodev -o ConnectTimeout=10 sbrelsfoard-pc '/bin/sh -c 
>>> '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 
>>> C:/Python27/python.exe && sleep 0'"'"''
>>> An exception occurred during task execution. The full traceback is:
>>> Traceback (most recent call last):
>>>   File 
>>> "c:\cygwin64\home\izodev\ansible_qajniv\ansible_module_command.py", line 
>>> 247, in <module>
>>>     from ansible.module_utils.basic import *
>>>   File 
>>> "c:\cygwin64\home\izodev\ansible_qajniv\ansible_modlib.zip\ansible\module_utils\basic.py",
>>>  
>>> line 52, in <module>
>>> ImportError: No module named grp
>>> fatal: [sbrelsfoard-pc]: FAILED! => {"changed": false, "failed": true, 
>>> "invocation": {"module_name": "command"}, "module_stderr": "Traceback (most 
>>> recent call last):\r\r\n  File 
>>> \"c:\\cygwin64\\home\\izodev\\ansible_qajniv\\ansible_module_command.py\", 
>>> line 247, in <module>\r\r\n    from ansible.module_utils.basic import 
>>> *\r\r\n  File 
>>> \"c:\\cygwin64\\home\\izodev\\ansible_qajniv\\ansible_modlib.zip\\ansible\\module_utils\\basic.py\",
>>>  
>>> line 52, in <module>\r\r\nImportError: No module named grp\r\r\n", 
>>> "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}
>>> NO MORE HOSTS LEFT 
>>> *************************************************************
>>> to retry, use: --limit @playbooks/getserverdb.retry
>>> PLAY RECAP 
>>> *********************************************************************
>>> sbrelsfoard-pc             : ok=0    changed=0    unreachable=0   
>>>  failed=1
>>>
>>>
>>>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/314474ac-6193-492c-b789-4b10b85c3aa2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to