Why Getting an Error"winrm or requests is not installed: No module named xmltodict" with Ansible Engine Managing Windows Hosts?

Solution Verified - Updated -

Environment

  • Ansible Engine

Issue

  • Unable to interface with Windows hosts on a new Ansible control host.

Resolution

  • Install package :

    # pip install "pywinrm>=0.2.2"
    

Please Note: You need to run the Windows provisioning PowerShell script on the windows host to configure winrm for Ansible. Please refer to our documentation: Windows System Preparation.

Root Cause

Diagnostic Steps

  • Run the below command :

    # ansible windows -i hosts -m win_ping
    x.x.x.x | FAILED! => {
       "msg": "winrm or requests is not installed: No module named xmltodict"
    }
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments