Ansible:使用基本身份验证对窗口计算机执行 ping 操作



>我已经使用Ansible团队建议的脚本在Windows Server 2012机器上配置了WinRM:https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

在 Ansible 控制机器(Linux 盒子(上,配置如下所示:

ansible_user: Administrator
ansible_password: PASS
ansible_port: 5985
ansible_connection: winrm
ansible_winrm_scheme: http
ansible_winrm_server_cert_validation: ignore

尝试pingWindows机器,我仍然得到:

10.2.75.142 | UNREACHABLE! => {
    "changed": false,
    "msg": "plaintext: the specified credentials were rejected by the server",
    "unreachable": true
}

用户凭据是本地 Windows 用户的工作凭据,属于管理员组。我是否仍然缺少两边的一些配置?

我也有类似的问题。通过Ansible,我得到了:

the specified credentials were rejected by the server

但是当使用Winrs从Windows机器执行命令时,它很好。例如:

winrs -r:https://myserver.com -u:Administrator -p:PASS ipconfig

正在经历。

不幸的是,没有找到任何解决方案可以让Ansible使用基本身份验证运行。解决方法是使用 NTLM 身份验证。刚刚添加

ansible_winrm_transport: ntlm

控制机器配置,从那以后它工作正常。

最新更新