ansible with win11 + ssh - failed to create temporary directory

Hi,
using ansible control node on debian 12.

~/ansible/hosts

[windows]
win11 ansible_host=192.168.20.100 ansible_ssh_user=username ansible_ssh_password=password

ansible all -i hosts -m win_ping

win11 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp `\"&& mkdir \"` echo ~/.ansible/tmp/ansible-tmp-1752053110.016204-4679-123677624522219 `\" && echo ansible-tmp-1752053110.016204-4679-123677624522219=\"` echo ~/.ansible/tmp/ansible-tmp-1752053110.016204-4679-123677624522219 `\" ), exited with result 1",
    "unreachable": true
}

How to fix this ?

Hi @ans00b, a few things

  1. Do you have the win11 machine setup with ssh? Ansible also provides winrm, which requires its own setup/configuration

  2. Can you run the command with -vvv to get additional details, please?

Have a read through Windows SSH — Ansible Community Documentation. You need to configure ansible_shell_type for your host so Ansible knows it is a Windows target and to avoid using things that won’t work on Windows.