Ansible: Install package with pip from a private git repo


I am trying to install a package from a private git repo using ansible’s pip module this way:

But this hangs when I try to provision this with vagrant, most likely because it prompts for confirmation to add the key to the list of known hosts. Indeed when I run this in vagrant:

It prompts for confirmation to add github to the know hosts and then works fine.

If I clone it with accept_hostkey=yes:

it works fine because it accepts the host key that is copied on vagrant. With the pip module there is no such option, any way around this?
As an alternative I could do a clone and then a python install but I’d rather do that in one step with pip.


The checkout command hangs because is not among the known hosts of your Ansible user. You should add the SSH key fingerprint to the /home/user/.ssh/known_hosts file. Fortunately, known_hosts is now a module available in Ansible 1.9:

If you are using Ansible < 1.9, you may use standard ssh-keygen commands:

Leave a Reply