6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ansibleでvagrantにssh接続できない

Last updated at Posted at 2015-10-28

##エラーメッセージ

ansible -i hosts vagrant-php -m ping                                                                                                                                                                                         
192.168.33.10 | FAILED => SSH Error: Host key verification failed.
    while connecting to 192.168.33.10:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

##原因
vagrant destroyで一度壊した仮想サーバのフィンガープリントが保存される。
そのままvagrant upをするとSSH接続時には、以前保存したこのフィンガープリントと、新しく出来たサーバのフィンガープリントが一致しなかったため、接続ができなかった。

##対策
viで~/.ssh/known_hostsファイルのエラーとなったIPアドレス(192.168.33.10)から始まる行を1行削除。
コメントの方法を参考にして改良した。
vagrant ssh-config "ホスト名" >> .ssh/configで設定し、
inventoryファイルにホスト名を追記で:ok:
##参考
http://qiita.com/grgrjnjn/items/8ca33b64ea0406e12938
http://mawatari.jp/archives/solution-of-vagrant-ssh-connection-error

6
7
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?