Ansible Docker连接下get_url模块无输出报错的调试求助
Ansible Docker连接场景下get_url任务模块失败的调试问题
环境配置
- 构建Docker镜像,Dockerfile内容:
FROM php:8.1.28-apache-bookworm RUN apt install -y python3 \ && ln -s /usr/bin/python3 /usr/bin/python
- 启动该镜像对应的容器
- 配置Ansible Inventory文件:
all: vars: ansible_connection: docker hosts: test-container:
- 执行的Ansible任务片段:
- name: Download limesurvey installation # debugger: on_failed ansible.builtin.get_url: url: "https://github.com/LimeSurvey/LimeSurvey/archive/refs/tags/{{ limesurvey_version }}.tar.gz" dest: "/tmp/limesurvey.tar.gz" mode: "755"
报错信息
执行任务后返回以下错误:
{ "changed": false, "module_stderr": "", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 0 }
已完成的排查
- 实际任务执行成功:文件已成功下载到容器的
/tmp/limesurvey.tar.gz路径,但Ansible仍返回模块失败错误 - 启用
ANSIBLE_KEEP_REMOTE_FILES=1后,手动在容器内运行Ansible上传的模块文件,执行过程无任何报错 - 本地调试get_url模块代码,定位到指定代码行后未发现异常错误信息
内容的提问来源于stack exchange,提问作者prumand
相关产品推荐
相关产品推荐

