i Cant connect to windows server

your server is still trying to ssh into the server.

host file should like this:

localhost ansible_connection=local

[win]
10.XXX.XXX.XXX

[win:vars]
ansible_connection=winrm
ansible_ssh_port=5986
ansible_ssh_user=
ansible_ssh_pass=
ansible_winrm_server_cert_validation=ignore

playbook should contain
hosts: win

and when you try running playbook, try
ansible-playbook XXX.yml -i hosts