windows - Ansible:无法 ping Windows VM,抛出 SSLError
问题描述
Ansible 服务器:Ubuntu 7.3.0-16ubuntu3
IP: 10.aa.bb.2
Windows 虚拟机:Windows Server 2016
IP: 10.aa.bb.1
用这个来ping:
ansible windows -m win_ping
抛出错误:
10.aa.bb.1 | UNREACHABLE! => {
"changed": false,
"msg": "ssl: HTTPSConnectionPool(host='10.aa.bb.1', port=5986): Max retries exceeded with url: /wsman (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),))",
"unreachable": true
}
我在 /etc/ansible/hosts 中配置了 windows vars,如下所示:
[windows]
10.aa.bb.1
[windows:vars]
ansible_user=username
ansible_password=password_for_windows
ansible_port=5986
ansible_connection=winrm
ansible_winrm_cert_validation=ignore
在 Windows VM 上,我为端口 5986 设置了入站规则,并且还运行了ConfiguringRemotingForAnsible.ps1 进行配置。结果winrm e winrm/config/listener
是:
Listener
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = 10.aa.bb.1, 127.0.0.1, ::1
Listener
Address = *
Transport = HTTPS
Port = 5986
Hostname = hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint = 036F429259C04211xxxxxxxxxxxxxxxxxxxxD5
ListeningOn = 10.aa.bb.1, 127.0.0.1, ::1
我不知道我是否遗漏了配置中的某些内容,因为如果我使用的 VM 都是在 Azure 中创建的,则不会有任何错误。
解决方案
尝试将此添加到您的库存文件中:
[tag_Name_Alican_Windows_Deneme]
[windows:children]
tag_Name_Alican_Windows_Deneme
这解决了我的类似问题。
否则没有ssl的连接是否有效?
推荐阅读
- google-kubernetes-engine - GKE 使用静态 IP 和扇出安装 nginx 入口
- python-3.x - 模拟行星绕太阳运行的轨迹。椭圆没有闭合
- javascript - 如何使用 webpack 为数组类型添加新功能
- javascript - 在用户键入时更新 contentEditable 字段中的文本
- c# - 如何使用订单号 WPF 调整 DataGrid 列?
- powerbi - 过滤汇总列
- vue.js - Vuetify Datatable - 仅在第一行渲染元素
- azure-devops - Azure DevOps:使用不同的运行设置在代理池中的代理上并行运行测试
- r - 使用 R 生成 Excel 样式的组合图 - 用于 x 轴上的分类数据
- c# - ASP.NET Identity 返回元数据资源错误