LoginSignup
7
7

More than 5 years have passed since last update.

VagrantでAnsibleを使うときのSSH鍵の登録方法

Posted at

VagrantとAnsibleを使ってVMの構築するとき、SSH鍵の登録に躓いたのでメモっとく
VagrantでAnsibleを実行するのは、〜/.vagrant.d/insecure_private_keyを使って認証するのだが、


vagrant ssh-config >> ~/.ssh/config

だけだと、ansible実行時SSH失敗する。
このとき設定で、HostNameを通信先のホストのIP、domainにする。

Host 適当
  HostName <対象ホストip/domain>
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile $HOME/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL
7
7
0

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
7
7