ansible
ansible copied to clipboard
docker : Unable to find required 'zipinfo' binary in the path. Command \"/bin/tar\" detected as tar type None. GNU tar required
Using docker like this this give me an error.
docker run --rm -it -v $(pwd):/ansible \
-v ~/.ssh/id_rsa:/root/.ssh/id_rsa \
-v $(pwd)/.ansible:/usr/share/ansible \
willhallonline/ansible:latest \
sh
I get this error
TASK [prometheus.prometheus.blackbox_exporter : Unpack blackbox_exporter binary] ***********
task path: /usr/share/ansible/collections/ansible_collections/prometheus/prometheus/roles/blackbox_exporter/tasks/install.yml:38
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240 `" && echo ansible-tmp-1716916954.4502718-281-25942118550240="` echo /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c 'test -e /tmp/blackbox_exporter-0.25.0.linux-amd64/blackbox_exporter && sleep 0'
Using module file /usr/lib/python3.11/site-packages/ansible/modules/stat.py
<localhost> PUT /root/.ansible/tmp/ansible-local-205v0s51yqs/tmpnsu9u01i TO /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/AnsiballZ_stat.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/ /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/AnsiballZ_stat.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/AnsiballZ_stat.py && sleep 0'
<localhost> PUT /tmp/blackbox_exporter-0.25.0.linux-amd64.tar.gz TO /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/source
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/ /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/source && sleep 0'
Using module file /usr/lib/python3.11/site-packages/ansible/modules/unarchive.py
<localhost> PUT /root/.ansible/tmp/ansible-local-205v0s51yqs/tmp54ci5zep TO /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/AnsiballZ_unarchive.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/ /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/AnsiballZ_unarchive.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/AnsiballZ_unarchive.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/ > /dev/null 2>&1 && sleep 0'
fatal: [nora-staging -> localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"attributes": null,
"copy": true,
"creates": "/tmp/blackbox_exporter-0.25.0.linux-amd64/blackbox_exporter",
"decrypt": true,
"dest": "/tmp",
"exclude": [],
"extra_opts": [],
"group": null,
"include": [],
"io_buffer_size": 65536,
"keep_newer": false,
"list_files": false,
"mode": null,
"owner": null,
"remote_src": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": "/root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/source",
"unsafe_writes": false,
"validate_certs": true
}
},
"msg": "Failed to find handler for \"/root/.ansible/tmp/ansible-tmp-1716916954.4502718-281-25942118550240/source\". Make sure the required command to extract the file is installed.\nCommand \"/usr/bin/unzip\" could not handle archive: unzip: short read\n\nUnable to find required 'zipinfo' binary in the path.\nCommand \"/bin/tar\" detected as tar type None. GNU tar required."
}
I am not sure that I need to make sure should be present to make it work. if I do zip -v or tar -v ...it's all present
Hello.
You need to install unzip and zipinfo
Look at the docs for the unarchive module for further info: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/unarchive_module.html#notes
I think it's important to note that those tools also have to be present on the host running Ansible, because the unarchive tasks get delegated to the localhost https://github.com/prometheus-community/ansible/blob/dc94de011ffdb079fbd6d64da0e63d2155dfb284/roles/process_exporter/tasks/install.yml#L40
Hello, ran into this as well with a self baked ansible image derived from alpine.
This doesn't have to do with the lack of unzip and zipinfo - this has to do with the version of tar in the image. It's a busybox variant because your image (willhallonline/ansible:latest) is derived from alpine linux.
You can check the module for unarchive ; it bails out if not GNU tar or bsdtar. When you "docker container run -it willhallonline/ansible:latest tar --version", you are likely seeing "tar (busybox) 1.36.1", which won't match. You can "apk add tar" as a build step and it should work after then as it will replace the busybox variant default.