When you ping a remote device with any of the remote Ad-Hoc commands as shown below, the above error will be prompted.
ansible win -m win_ping
ansible all -i hosts -m win_ping
The error above might be prompted if you do not have the host inventory file configured correctly, because in the /etc/ansible/hosts file, the password was not specified and the Ansible WinRM server cert validation was not set to ignore. This behaviour is intentional.
- ansible_pass=SecretPasswordGoesHere - ansible_winrm_server_cert_validation=ignore
Complete the host file as shown above. When this these parameters are entered correctly, the following errors will no longer be prompted.
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.