Ansible, and openssh on Windows 10

50 views
Skip to first unread message

John Harmon

unread,
May 23, 2019, 3:26:59 PM5/23/19
to Ansible Project
Just messing around, but I setup openssh on Windows 10.  My administrative user, john, is configured with the public key for my root user from the ansible server.  I can ssh from ansible to windows 10 without a password, and things look fine.  When trying a simple playbook, however, I get failures left and right.  Just wondering if doing this via ssh is even possible yet with windows?  I see people out there doing this via cygwin, but not necessarily the openssh that ships with Windows 10.

fatal: [win10]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"win10\". Make sure this host can be reached over ssh", "unreachable": true}


John Harmon

unread,
May 23, 2019, 4:52:37 PM5/23/19
to Ansible Project
I am assuming it isn't quite baked yet.  The ControlPath and other things look to be all linux-based (ie. /bin/sh).

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************
task path
: /etc/ansible/playbooks/one-offs/windows/test.yml:3
<win10> Attempting python interpreter discovery
<win10> ESTABLISH SSH CONNECTION FOR USER: john
<win10> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="john"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/a2a184ae5b win10 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<win10> (1, '', 'The system cannot find the path specified.\r\n')
<win10> Failed to connect to the host via ssh: The system cannot find the path specified.
 
[WARNING]: Unhandled error in Python interpreter discovery for host win10: unexpected output from Python interpreter discovery

<win10> Interpreter discovery remote stderr:
The system cannot find the path specified.

Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
Pipelining is enabled.
<win10> ESTABLISH SSH CONNECTION FOR USER: john
<win10> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="john"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/a2a184ae5b win10 '/bin/sh -c '"'"'sudo -H -S -n  -u john /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-wwkxsloatrpecpvtnxmjliczqzkrfzle ; /usr/bin/python'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<win10> (1, '', 'The system cannot find the path specified.\r\n')
<win10> Failed to connect to the host via ssh: The system cannot find the path specified.
fatal
: [win10]: FAILED! => {
   
"ansible_facts": {},
   
"changed": false,
   
"msg": "The following modules failed to execute: setup\n  setup: MODULE FAILURE\nSee stdout/stderr for the exact error\n"
}


Richard Bywater

unread,
May 25, 2019, 7:14:32 AM5/25/19
to ansible...@googlegroups.com
Haven't used it myself as I only manage Linux hosts but https://docs.ansible.com/ansible/latest/user_guide/windows_faq.html#can-i-connect-to-windows-hosts-over-ssh is relevant to your query.

Richard.

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/820a7b12-6642-4577-9f9b-fc92c9b87021%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages