前言

部署某环境的时候,我使用ansibleunarchive模块解压某xx.tar.gz文件报错:

 "msg": "Failed to find handler for \"/tmp/xxx.tar.gz\". Make sure the required command to extract the file is installed. Command \"/usr/bin/gtar\" could not handle archiveCommand \"unzip\" not found. Command \"/usr/bin/gtar\" found no files in archive

使用到ansible的playbook如下:

unarchive: src=/tmp/{{module}}.tar.gz dest={{home}}/srv/{{module}}/ copy=no mode=0755

分析

从报错信息来看,指的我的tar.gz文件没有合适的解压程序:gtar和unzip无法处理该文件,最后说是gtar发现该archive包中没有文件。

最开始我我还以为是Linux上没有对应解压工具,后来发现是压缩包内容为空导致的。我去该环境上用tar去解压该压缩包,确实没有文件。看报错也是一门艺术,要细看,仔细推敲。。

 

快送门:各种学习资料与大厂招聘

博主:测试生财(一个不为996而996的测开码农)

座右铭:专注测试开发与自动化运维,努力读书思考写作,为内卷的人生奠定财务自由。

内容范畴:技术提升,职场杂谈,事业发展,阅读写作,投资理财,健康人生。

csdn:https://blog.csdn.net/ccgshigao

博客园:https://www.cnblogs.com/qa-freeroad/

51cto:https://blog.51cto.com/14900374

微信公众号:测试生财(定期分享独家内容和资源)

ansible:unarchive模块解压报错_ansible