ansible - 使用 Ansible 配置 Ubuntu WSL 环境
问题描述
我可以通过在 Ubuntu WSL 中运行 Ansible 来使用 Ansible/Chocolatey 配置 Windows 10。我现在正在尝试使用同一个 Ansible 实例来配置 Ubuntu WSL 环境。它似乎正确地进行了身份验证,但是当我尝试从 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
这是我的inventory.yml:
all:
children:
ubuntu-wsl:
hosts:
localhost-wsl:
ansible_port: 22
ansible_host: localhost
ansible_password: "{{ passwordd}}"
ansible_user: "{{ usernamee}}"
这是我的 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
任何人都可以发现错误或提出可能的解决方案吗?我也无法使用本地类型连接使其工作(上面使用的是 SSH)。
谢谢
解决方案
解决方案是将 Ubuntu WSL 环境升级到 WSL 2。请参阅https://docs.microsoft.com/en-us/windows/wsl/install-win10#update-to-wsl-2
推荐阅读
- swift - 使用 SwiftUI Navigation View 和 Sorted FetchRequest 在详细视图中重新排列列表项时出现问题
- solr - Solr Suggester 需要很长时间才能提供响应
- flutter - 如何在颤动中解析格式为“MM/dd/YY”的日期时间
- html - 引导程序 - 同一行
和按钮 - rust - Rust:如何将 BytesMut 转换/读取为文件?
- rust - 如何使用 Substrate API Client 写入 Substrate 的存储?
- c++ - 为什么要在这里计算余数?
- laravel - 在 Laravel 中使用 imagejpeg()
- javascript - 根据按钮点击显示隐藏内容
- html - 指定特定类时强制 div 子文本颜色