Why can't my Ansible server not communicate with my Windows XP machine? [closed]
Ansible's official documentation says Windows XP is not a supported os, however, for every day that goes by I'm even more certain you could make it work.
The server is a CentOS 7 machine. I can establish a SSH connection to the Windows XP machine from my server and vice versa.
This is my Ansible hosts file entry for the Windows XP machine:
[winxp]
10.0.2.4
[winxp:vars]
ansible_user=nico
ansible_connection=ssh
ansible_port=22
This is the output when executing ansible winxp -m win_ping
:
10.0.2.4 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ----USAGE WARNING---- This is a private computer system. This computer system, including all related equipment, networks, and network devices (specifically including Internet access) are provided only for authorized use. This computer system may be monitored for all lawful purposes, including to ensure that its use is authorized, for management of the system, to facilitate protection against unauthorized access, and to verify security procedures, survivability, and operational security. Monitoring includes active attacks by authorized entities to test or verify the security of this system. During monitoring, information may be examined, recorded, copied and used for authorizedpurposes. All information, including personal information, placed or sent over this system may be monitored. Use of this computer system, authorized or unauthorized, constitutes consent to monitoring of this system. Unauthorized use may subject you to criminal prosecution. Evidence of unauthorized use collected during monitoring may be used for administrative, criminal, or other adverse action. Use of this system constitutes consent to monitoring for these purposes.
Permission denied (publickey,password,keyboard-interactive).", "unreachable": true }
Why does it say "Failed to connect to the host via ssh:"
when it can perfectly do so outside of Ansible?
Adding this line to the hosts file doesn't change anything:
ansible_ssh_server_cert_validation='ignore'
And adding the line ansible_password=xxxx
and executing the same command shows the following output:
10.0.2.4 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ",
"unreachable": true
}
Does anyone have any idea? Is it really impossible? Do I need a specific python version, powershell version, or anything else installed on the Windows XP machine?
EDIT: WORKAROUND FOR THIS
So, as mentioned on the answer, Ansible can't be used on Windows XP. However, there is a workaround for this. You can create a playbook that runs commands on the Windows XP machine using sshpass, and run that playbook on the same Ansible machine. Here is the playbook I used:
---
- hosts: ansible_server
tasks:
- name: Test
shell: sshpass -p 'nico' ssh [email protected] "cmd.exe /c mkdir C:\it_works"
Hope this can help someone
Even if you manage to get ssh to connect successfully, Ansible requires PowerShell 3.0, which does not work on Windows XP. It needs 2008/Vista or later. You don't need to waste any more time with trying to make it work.