我看到了很多相反的信息(即如何使用WSL作为服务器来使用Winrm配置Windows),但是我找不到有关在另一个环境中使用Ansible实际配置WSL(1和2)的任何信息。机器。
我的设置如下:
为hosts.yml
使用以下内容:
all:
children:
desktops:
hosts:
wsl:
ansible_host: 192.168.1.204
ansible_user: my-windows-user
我得到以下输出(至少它可以理解那里有一台机器):
> ansible wsl -m ping
wsl | UNREACHABLE! => {
"changed": false,
"msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1574712678.8429368-151724391009763 `\" && echo ansible-tmp-1574712678.8429368-151724391009763=\"` echo ~/.ansible/tmp/ansible-tmp-1574712678.8429368-151724391009763 `\" ), exited with result 1",
"unreachable": true
}
对于WSL 1和WSL 2实例都会发生这种情况。有什么想法吗?
P.S。如果WSL实例的用户名/密码错误,那么输出将变为(因此,在某种程度上这里进行了一些正确的身份验证):
wsl | UNREACHABLE! => {
"changed": false,
"msg": "Invalid/incorrect password: Permission denied, please try again.",
"unreachable": true
}