I’m running an ansible playbook the following way:
- created a docker-image
FROM php:8.1.28-apache-bookworm
RUN apt install -y python3
&& ln -s /usr/bin/python3 /usr/bin/python
- started the container
- Added it to my inventory
all:
vars:
ansible_connection: docker
hosts:
test-container:
- Ran the following task
- 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"
and I get the following error:
{
"changed": false,
"module_stderr": "",
"module_stdout": "",
"msg": "MODULE FAILUREnSee stdout/stderr for the exact error",
"rc": 0
}
I’m pretty sure, that this is a setup issue, but how can I debug this error?
UPDATE:
- the task seems to work, but ansible complains
- Adding
ANSIBLE_KEEP_REMOTE_FILES=1
allows to run re-run the files locally, also adding debug statements. It didn’t help, because running the files in the container just worked (see -vvv for the actual commands). - I edited the local get_url module and raised Exception till I pinned down the error to the following line.
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/get_url.py#L432. That worked because I always found the specific error, except after the line in question
4
I couldn’t solve my problem, but I learned how to debug and module-failure without any additional infos.
- run the playbook with
-vvvv
- Adding ANSIBLE_KEEP_REMOTE_FILES=1 allows to run re-run the files locally
- You can now run the files on the targeted machine (depending on task an setup e.g.
/root/.ansible/tmp/ansible-tmp-xxxx/AnsibleZ_stat.py
) - If you add
explode
as first argument you can also edit the module (normally embedded as a zip). - If you cannot easily access the remote machine, you can also edit the local module file. I raised exceptions to find my way round. On every run it’s updated.