ansible/ansible — pull request #2418 by davehughes (2013-03-15 22:50:44+00:00)
Title: pip module - run from the system's temp directory to avoid permissions problem

I ran into a permissions problem installing dependencies with pip from a git repository.

**ansible task:**
```yaml
- name: install pip dependencies
pip: requirements=/home/service-user/requirements.txt
virtualenv=/home/service-user/env
extra_args='--exists-action w' # choose action to avoid interactive prompt
sudo: true
sudo_user: service-user
```

**requirements.txt:**
```
-e git+git://github.com/kennethreitz/requests#egg=requests
```

I tracked the issue down to git temporarily switching directories as `service-user` and then being unable to switch back to the directory of the ansible runner user. [This Stack Overflow post](http://stackoverflow.com/questions/9851644/git-pulling-depends-on-the-current-dir) discusses a similar issue.

My fix just switches to the system temp directory to run the pip command, a directory that any user should be able to switch back to.