Why Am I Getting "winrm or requests is not installed: No module named xmltodict" Error with Ansible Engine Managing Windows Hosts?
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
Ansible requires the winrm Python module to interface with Windows remote hosts. For more details, see Windows Support: Installing on the Control Machine
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.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
