紙一重の積み重ね

アラフォーのエンジニアがなれる最高の自分を目指して、学んだことをこつこつ情報発信するブログです。

【Ansible】Zip圧縮時に "msg": "non-zero return code", "rc": 3 が出たときの対処法

f:id:yokoyantech:20171117184840p:plain

状況

ansible provison時に発生

環境

  • Ansible 2.6.0
  • Ubuntu 16.04

発生したエラー

failed: [default] (item=hogehoge) => {"changed": true, "cmd": "zip -D /home/vagrant/hogehoge.zip *", "delta": "0:00:00.032748", "end": "2018-07-05 07:49:55.730576", "item": "hogehoge", "msg": "non-zero return code", "rc": 3, "start": "2018-07-05 07:49:55.697828", "stderr": "", "stderr_lines": [], "stdout": "\tzip warning: missing end signature--probably not a zip file (did you\n\tzip warning: remember to use binary mode when you transferred it?)\n\tzip warning: (if you are trying to read a damaged archive try -F)\n\nzip error: Zip file structure invalid (/home/vagrant/hogehoge.zip)", "stdout_lines": ["\tzip warning: missing end signature--probably not a zip file (did you", "\tzip warning: remember to use binary mode when you transferred it?)", "\tzip warning: (if you are trying to read a damaged archive try -F)", "", "zip error: Zip file structure invalid (/home/vagrant/hogehoge.zip)"]}

解決策

  • vagrantにsshする
  • 0バイトのzipファイルを消す

考えられる原因

  • Andibleが失敗したときに0バイトのzipファイルができていると思われる