Question: No module named 'winrm'
嘗試使用 Ansible win_ping 模組,測試是否能夠連接 Windows 主機時,卻發生「winrm or requests is not installed: No module named 'winrm'」的錯誤訊息,但檢查後發現是有安裝 pywinrm 模組的?Answer:
查了很多資料之後,突然發現系統的 Python 版本為 3.9.16,但是 Ansible 檢查版本時卻顯示 Python 版本為 3.11.2?
參考資源
- Connecting to a Windows Host (ansible.com)
- Setting up a Windows Host — Ansible Documentation
- Using Ansible and Windows — Ansible Documentation
- Windows Remote Management — Ansible Documentation
- Chapter 38. Configuring the unversioned Python Red Hat Enterprise Linux 8 | Red Hat Customer Portal
- How to set up and use Python virtual environments for Ansible | Enable Sysadmin (redhat.com)