Ansible:无法在Windows节点上ping [SSL:CERTIFICATE_VERIFY_FAILED]
问题描述:
我有一台Ubuntu 16.04 virtuell机器和两台MS Windows Server 2008 R 2 virtuell机器。Ansible:无法在Windows节点上ping [SSL:CERTIFICATE_VERIFY_FAILED]
我遵循this指示,直到“一旦我们有这两个文件设置,我们可以看看测试连接”。现在我想ping Windows虚拟机。我得到了指挥官的一个错误,但我不知道你是谁。
执行:
[email protected]:~/ansible_test$ ansible windows -i host -m win_ping
答:
[IP-ADRESS] | FAILED! => {
"failed": true,
"msg": "ERROR! ssl: 500 WinRMTransport. [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:"
}
[IP-ADRESS] | FAILED! => {
"failed": true,
"msg": "ERROR! ssl: 500 WinRMTransport. [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:"
}
不要ü知道WY它没有工作?
答
我得到了解决,但我不满意,因为这对我来说不是正确的解决方案,但它的工作原理。
创建的文件夹ansible_test:
import ssl
if hasattr(ssl, '_create_default_https_context') and hasattr(ssl, '_create_unverified_context'):
ssl._create_default_https_context = ssl._create_unverified_context
class CallbackModule(object):
pass
运行:
ansible windows -i host -m win_ping -vvvvv
结果:
10.92.0.38 | SUCCESS => {
"changed": false,
"invocation": {
"module_name": "win_ping"
},
"ping": "pong"
}
文件中
mkdir callback_plugins
nano callback_plugins/fix-ssl.py
写
答
为了能够配置Windows机器,您需要在Windows机器上运行此Power Shell,首先要为winrm生成证书文件。
https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
+0
我已经运行了这个脚本。脚本执行成功,但主机/目标之间的连接不起作用。 –
什么是主机/目标机器上的python版本? – user2599522
我已经安装了python 2.7.12版。它仍然不起作用 –