Rob
Rob

Reputation: 23

Breaking agent forwarding in Ansible on Vagrant

Using Ansible to provision Vagrant box, Ansible fails when cloning Git repo: Host key verification failed. fatal: Could not read from remote repository.. Oddly I can clone from Git with no issues when I SSH into the box and run git clone <GIT_URL>. Have set sudo: no in Ansible task but still fails. ssh-agent is running correctly on both host and box.

Upvotes: 2

Views: 279

Answers (1)

Jakuje
Jakuje

Reputation: 26006

Host key verification failed. 

is not related to the agent forwarding. As noted in the comments, it is related to the known_hosts file.

Before the first connection to the server (github.com), you need to manually verify it's host key, or use similar process as noted in comments, using keyscan:

ssh-keyscan -H github.com >> ~/.ssh/known_hosts

The other (not recommended) possibility is to turn off the host key verification in the ~/.ssh/config:

Host git
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null

in the home directory of the user running the git clone.

Upvotes: 2

Related Questions