gpt4 book ai didi

linux - Ansible - 未安装 winrm 或请求

转载 作者:太空宇宙 更新时间:2023-11-04 11:49:30 25 4
gpt4 key购买 nike

我试图从我的 Fedora Virtual Box 中安装的 Ansible 连接 Windows 2016 机器。我在我的 fedora 机器上安装了 python-pip 和 Pywinrm。

当我尝试使用以下命令连接时

ansible all -i hosts -m win_ping -vvv

我遇到了以下错误

ansible 2.8.0
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.3 (default, May 11 2019, 00:45:16) [GCC 8.3.1 20190223
(Red Hat 8.3.1-2)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /home/ansible/hosts as it did not pass it's
verify_file() method
script declined parsing /home/ansible/hosts as it did not pass it's
verify_file() method
auto declined parsing /home/ansible/hosts as it did not pass it's
verify_file() method
Parsed /home/ansible/hosts inventory source with ini plugin
META: ran handlers
Using module file /usr/lib/python3.7/site-
packages/ansible/modules/windows/win_ping.ps1
Pipelining is enabled.
xx.xxx.xx.xxx | FAILED! => {
"msg": "winrm or requests is not installed: No module named 'winrm'"
}

下面是我使用的主机文件

[win]
xx.xxx.xx.xxx

[win:vars]
ansible_user=UserName.admin@test.com
ansibe_password=Password
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

最佳答案

我也找了很久,终于找到了

不要在虚拟环境中运行,在基础环境中运行

pip install pywinrm

我的python版本:3.7.3

我的 pip 版本:来自/Users/darcy/code/miniconda3/lib/python3.7/site-packages/pip (python 3.7) 的 pip 19.3.1

pywinrm 版本:0.4.1

关于linux - Ansible - 未安装 winrm 或请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56478696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com