[英]Provision Ubuntu WSL Environment Using Ansible
I am able to provision Windows 10 using Ansible/Chocolatey by running Ansible in Ubuntu WSL.我可以通过在 Ubuntu WSL 中运行 Ansible 来使用 Ansible/Chocolatey 提供 Windows 10。 I am now trying to provision the Ubuntu WSL environment using that same Ansible instance.我现在正在尝试使用相同的 Ansible 实例来配置 Ubuntu WSL 环境。 It seems to authenticate properly but I'm getting the following permission error when I try to provision Ubuntu WSL from Ubuntu WSL itself:它似乎正确地进行了身份验证,但是当我尝试从 Ubuntu WSL 本身提供 Ubuntu WSL 时出现以下权限错误:
fatal: [localhost-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 /tmp/.ansible-${USER}/tmp/ansible-tmp-1594006839.9280272-267367995921233 `\" && echo ansible-tmp-1594006839.9280272-267367995921233=\"` echo /tmp/.ansible-${USER}/tmp/ansible-tmp-1594006839.9280272-267367995921233 `\" ), exited with
result 1, stdout output: ansible-tmp-1594006839.9280272-267367995921233=/tmp/.ansible-***/tmp/ansible-tmp-1594006839.9280272-267367995921233\n", "unreachable": true}
[WARNING]: Failure using method (v2_runner_on_unreachable) in callback plugin
(<ansible.plugins.callback.mail.CallbackModule object at 0x7feccbade550>): [Errno
111] Connection refused
Here's my inventory.yml:这是我的inventory.yml:
all:
children:
ubuntu-wsl:
hosts:
localhost-wsl:
ansible_port: 22
ansible_host: localhost
ansible_password: "{{ passwordd}}"
ansible_user: "{{ usernamee}}"
And here's my ansible.cfg:这是我的 ansible.cfg:
[defaults]
inventory = inventory.ymlforks = 50
transport = ssh
gathering = smart
fact_caching = jsonfile
fact_caching_connection = ~/.ansible/factcachingconnection
callback_whitelist = mailfact_caching_timeout = 60480000hash_behavior = merge
retry_files_enable = False
pipelining = True
host_key_checking = False
remote_tmp = /tmp/.ansible-${USER}/tmp
[winrm_connection]
server_cert_validation = ignore
transport = credssp,ssl
[ssh_connection]
transfer_method = piped
Can anyone spot an error or suggest a possible solution?任何人都可以发现错误或提出可能的解决方案吗? I was unable to get it working using the local type connection as well (the above is using SSH).我也无法使用本地类型连接使其工作(上面使用的是 SSH)。
Thanks谢谢
The solution to this was upgrading the Ubuntu WSL environment to WSL 2. See https://docs.microsoft.com/en-us/windows/wsl/install-win10#update-to-wsl-2解决方案是将 Ubuntu WSL 环境升级到 WSL 2。请参阅https://docs.microsoft.com/en-us/windows/wsl/install-win10#update-to-wsl-2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.