ansible:unarchive模块解压报错

前言

部署某环境的时候,我使用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 archiveide

使用到ansible的playbook以下:工具

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

分析

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

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

 

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

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

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

csdn:https://blog.csdn.net/ccgshigaoip

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

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

在码农的苦闷岁月里,期待咱们一块儿成长,欢迎关注,感谢拍砖!