Using SSH config of 'become' user for pip installation

Hello,

I have a server where I need to pip install requirements from two separate github instances with two separate deploy keys (github doesn’t allow having the same deploy key for two different repositories). This is easy enough to do by creating an ssh config file for the user running the install:

Host project1 github.com

Hostname github.com

Identityfile /home/project_user/.ssh/id_rsa_project1

Host project2 github.com

Hostname github.com

Identityfile /home/project_user/.ssh/id_rsa_project2

Then I set the hosts respectively in my requirements.txt (e.g., git+ssh://git@project1/github-user/some_project.git#egg=some_project). This works perfectly when running pip install as the project user on the server.

However, when doing this via ansible and ‘become_user’, it ignores the user’s .ssh/config file and it fails. How would I configure ansible to use two separate keys for a pip install?

Thanks in advance!

Using 'pip' module or 'shell' and a pip command line?

How does it fail (whats the ansible output include if used with '-vvv')?

Is both 'become_user: youruser' and 'become: true' enabled? (ala
http://docs.ansible.com/ansible/become.html#directives)

Not sure how the pip module handles multiple Host/keys. Seems like it
should work but I haven't tried to reproduce.

I'm assuming the ssh config with the Host stanzas is the standard
.ssh/config in youruser home directory?

Is ssh agent forwarding being used?