# ansible-pull git checkout Host key verification

**URL:** <https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862>\
**Category:** Ansible Project\
**Created:** [November 7, 2013, 3:27pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862 "2013-11-07T15:27:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [November 7, 2013, 3:27pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/1 "2013-11-07T15:27:28Z")

</div>

Hi,

I’m having the bellow problem trying to run ansible-pull mode cronjob. When I bring up a new instance and install the cronjob, ansible-pull mode will fail because Host key verification failure :

“”"

Running: ‘ansible all -i “localhost,” -c local --limit “localhost:ip-10-120-170-189.eu-west-1.compute.internal:127.0.0.1” -m git -a “[name=git@github.com](mailto:name=git@github.com):some-repo/project.git dest=/root/myprojec version=myBranch”’

localhost | FAILED \>\> {  
“cmd”: “/usr/bin/git ls-remote [git@github.com](mailto:git@github.com):some-repo/project.git -h refs/heads/myBranch”,  
“failed”: true,  
“msg”: “Host key verification failed.\r\nfatal: The remote end hung up unexpectedly”,  
“rc”: 128,  
“stderr”: “Host key verification failed.\r\nfatal: The remote end hung up unexpectedly\n”,  
“stdout”: “”  
}

“”"

If I run the ansible–pull command manually the first time it asks me the bellow :

“”"

The authenticity of host ‘[github.com](http://github.com) (192.30.252.131)’ can’t be established.

RSA key fingerprint is 15:27:ac:a5:76:18:2d:36:63:1b:54:4d:eb:df:a6:48.

Are you sure you want to continue connecting (yes/no)?

“”"

Once I accept “yes” it won’t ask me again and ansible-pull cronjob will work automatically with no issues.

How can I avoid the manual authentication so the cronjob will work the first time automatically ??

Regards,

Nicolas.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 7, 2013, 3:36pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/2 "2013-11-07T15:36:03Z")

</div>

Take a look through

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [November 7, 2013, 4:09pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/3 "2013-11-07T16:09:51Z")

</div>

Hi James, thanks for the reply.

I already have host\_key\_checking = False in the ansible.cfg file that is checked out from [github.com](http://github.com):some-repo/project.git in the example but I think ansible-pull is still using the default values…

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 7, 2013, 4:18pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/4 "2013-11-07T16:18:22Z")

</div>

What is the directory structure in your checkout? Can you show me the “tree .” or “find .” output?

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [November 7, 2013, 4:27pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/5 "2013-11-07T16:27:44Z")

</div>

tree -L 1 /root/myprojec  
/root/myprojec

├── ansible.cfg  
├── site.yml

├── etc  
├── group\_vars  
├── hosts  
├── private\_vars

├── production.yml  
├── README.md

├── roles

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 7, 2013, 7:48pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/6 "2013-11-07T19:48:28Z")

</div>

Ah, I completely misread your first email. You aren't having a problem with connecting to the inventory host (localhost), it's the github key that is falling over when ansible-pull tries to check out your repo.

Are you calling ansible-pull from a cronjob? The simplest fix is to run ssh-keyscan before you pull the repo ...

ssh-keyscan github.com \>\> ~/.ssh/known\_hosts  
ansible-pull \<args\>

This is also noted in the git module docs.

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [November 7, 2013, 9:42pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/7 "2013-11-07T21:42:27Z")

</div>

Thanks James it’s working now.

Do you know if the [github.com](http://github.com) public key ever changes ? I prefer to edit the known\_hosts with Ansible once than running this command every time.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 7, 2013, 9:44pm UTC](https://forum.ansible.com/t/ansible-pull-git-checkout-host-key-verification/13862/8 "2013-11-07T21:44:18Z")

</div>

Not really sure. However, hostkeys could change for various reasons.
