我是Ansible的新手并尝试使用Ansible连接到Windows机器 . 我收到了以下错误
xxx.xxx.xxx.com | UNREACHABLE! => {
"changed": false,
"msg": "plaintext: HTTPConnectionPool(host='xxx.xxx.xxx.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x3d76050>: Failed to establish a new connection: [Errno 111] Connection refused',))",
"unreachable": true
}
我已经对这三个文件进行了更改 .
- 库存:
[windows] xxx.xxx.xxx.com
- Krb5.conf
[领域] XXX.XXX.COM = [domain_realm] .xxx.xxx.com = XXX.XXX.COM
- group_vars / windows.yml
ansible_ssh_user:user ansible_ssh_pass:password ansible_ssh_port:5985 ansible_connection:winrm
我是新手,可能在连接过程中犯了错误 . 任何帮助,将不胜感激 . 提前致谢 .
1 回答
msg键说“plaintext”,你需要使用ansible提供的PowerShell脚本在Windows主机上启用winrm over ssl:
https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
由于这将添加自签名证书,请务必将
ansible_winrm_server_cert_validation: ignore
添加到您的group_vars / windows.yml