Gradle ssh プラグインで reject HostKey エラー

CentOS7 への Django アプリケーションデプロイを Gradle で半自動化 したが、別の仮想マシン接続先を変更したら、以下のエラー

  1. * What went wrong:

  2. Execution failed for task ':deploy'.

  3. > com.jcraft.jsch.JSchException: reject HostKey: 192.168.0.35

  4. * Try:

  5. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  6. BUILD FAILED

https://stackoverflow.com/questions/36374260/reject-hostkey-when-deploying-jar-with-gradle-ssh-plugin

ssh.settings {
     knownHosts = allowAnyHosts}

を追記して、成功

  1. task deploy {
  2. doLast {
  3. ssh.settings {
  4. knownHosts = allowAnyHosts}
  5. ssh.run {
  6. session(remotes.web02) {
  7. execute "rm -R -f ${REOMOTE_PATH}/${APP_NAME}"
  8. execute "rm -f ${REOMOTE_PATH}/${APP_NAME}.zip"
  9. put from:"${projectDir}\\${BUID_DIR}\\${APP_NAME}.zip", into:"${REOMOTE_PATH}/${APP_NAME}.zip"
  10. execute "unzip ${REOMOTE_PATH}/${APP_NAME}.zip -d ${REOMOTE_PATH}"
  11. }
  12. }
  13. }
  14. }

Follow me!

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です