我是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
}
我已经对这三个文件进行了更改。
清单:
[窗] xxx.xxx.xxx.com
的krb5.conf
[领域] XXX.XXX.COM = { kdc = xxx.xxx.xxx.com admin_server = xxx.xxx.xxx.com } [domain_realm] .xxx.xxx.com = XXX.XXX.COM
group_vars / windows.yml
ansible_ssh_user:用户 ansible_ssh_pass:密码 ansible_ssh_port:5985 ansible_connection:winrm
我是新手,可能在连接过程中犯了错误。 任何帮助,将不胜感激。提前谢谢。
答案 0 :(得分:0)
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