我被Ansible窗口模块困住了。我只是想对Windows机器执行ping操作,但是出现``连接超时''的提示
主机
[windows]
192.168.1.13
group_vars / windows.yaml
ansible_user: raja
ansible_password: myPassword
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
当我跑步时: ansible windows -vvv -i hosts -m win_ping
Using /etc/ansible/ansible.cfg as config file
<192.168.1.13> ESTABLISH WINRM CONNECTION FOR USER: raja on PORT 5986 TO 192.168.1.13
192.168.1.13 | UNREACHABLE! => {
"changed": false,
"msg": "ssl: HTTPSConnectionPool(host='192.168.1.13', port=5986): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fcb12024a90>, 'Connection to 192.168.1.13 timed out. (connect timeout=30)'))",
"unreachable": true
}
但是我可以使用 ping 192.168.1.13
您需要为Windows机器进行PowerShell远程管理做准备,否则ansible将无法连接到它。为了使大多数功能正常运行,您将至少需要安装PowerShell 3.0(仅Windows 7 SP1或Windows Server 2008 SP1及更高版本支持此功能),并运行此脚本,这不仅会启用WinRM,而且还会安装一些必需的功能。连接正常工作的证书。
卸载ConfigureRemotingForAnsible.ps1
文件后,将从命令行执行以下命令:
powershell.exe-文件ConfigureRemotingForAnsible.ps1
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句