prometheus-community / ansible

Ansible Collection for Prometheus
https://prometheus-community.github.io/ansible/
Apache License 2.0
327 stars 115 forks source link

docker : Unable to find required 'zipinfo' binary in the path. Command \"/bin/tar\" detected as tar type None. GNU tar required #369

Open rossm-mf opened 1 month ago

rossm-mf commented 1 month ago

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

gardar commented 1 month ago

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