简体   繁体   English

使用 Ansible 提供 Ubuntu WSL 环境

[英]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.

相关问题 使用Vagrant和Ansible设置ubuntu / xenial64 - Provision ubuntu/xenial64 using Vagrant and Ansible 使用Ansible Clouldformation模块配置CoreOS集群 - Using Ansible Clouldformation module to provision a CoreOS cluster 如果未使用Ansible运行,则置备EC2实例 - Provision EC2 instances if NOT running using Ansible 使用 WSL 中 Localhost 上的 Ansible 模块服务启动 Apache2 失败 Ubuntu 20.04.3 LTS(焦点) - Failed to start Apache2 using Ansible Module Service on Localhost in WSL Ubuntu 20.04.3 LTS (focal) 无法在 WSL 2 Ubuntu20.04 上通过 Ansible 启动服务 - Cannot start service via Ansible on WSL 2 Ubuntu20.04 Ubuntu WSL Ansible - user@localhost 权限被拒绝(公钥,密码) - Ubuntu WSL Ansible - user@localhost Permission denied(publickey,password) 使用Vagrant使用Ansible使用暂停操作进行配置时出错 - Error when using Vagrant to provision with Ansible using pause action 带有ansible的AWS配置 - AWS provision with ansible Vagrant可以在另一个Vagrant VM中使用Ansible安装来配置VM吗? - Can Vagrant provision a VM using an Ansible installation in another Vagrant VM? Ansible playbook 在新的 Ubuntu/Ansible/Python 环境中停止工作 - Ansible playbook stops working in new Ubuntu/Ansible/Python environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM