'FAILED! => {"msg": "winrm or requests is not installed: No module named 'winrm'"}
I am working on ansible and windows vm(windows server 2019) and getting the error above.
I have added python3 -m pip install --user --ignore-installed pywinrm
in the yml steps too.
** - script: | echo Installing $(caCertificate.secureFilePath) to the trusted CA directory... chown root:root $(caCertificate.secureFilePath) chmod a+r $(caCertificate.secureFilePath) python3 -m pip install testresources python3 -m pip install --user --ignore-installed pywinrm **
error log: TASK [Gathering Facts] ********************************************************* fatal: [host1]: FAILED! => {"msg": "winrm or requests is not installed: No module named 'winrm'"}
PLAY RECAP ********************************************************************* host1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
##[error]Command ansible-playbook -i /home/vsts/work/1/s/inventories/production/windows_hosts /home/vsts/work/1/s/site.yml exited with code 2. Finishing: Ansible
Extremely new to Ansible
Solution 1:[1]
Can you please run ansible --version
. The last line should confirm if you are using Python 2 or Python 3, ie:
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 9.2.1 20191008]
Can you confirm that you've run pip3
on the same machine you are running ansible-controller
So in my case I'd need to use pip2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gundalow |