前言
部署某環境的時候,我使用ansible的unarchive模塊解壓某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 archive. Command \"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
微信公眾號:測試生財(定期分享獨家內容和資源)