title: user vs sudo vs sudo_user in ansible playbooks
body: <p>I have read the Ansible documentation but I am still a bit confused about the three following parameters in ansible playbooks: user, sudo, sudo_user. </p>
  
  <p>I have tried the following playbooks with different combination of the parameters:</p>
  
  <ol>
  <li><p>user:deploy => Works</p></li>
  <li><p>user:deploy and sudo: True => <strong>Hangs on the git task</strong></p></li>
  <li><p>user:deploy, sudo: True and sudo_user: deploy => Works</p></li>
  </ol>
  
  <p>What does sudo_user actually do?
  When and why should I use each of these combinations?</p>
  
  <pre><code>- hosts: all
    user: deploy
    sudo: True
    sudo_user: deploy
  
    tasks:
        - name: Ensure code directory
          file: dest=/home/deploy/code state=directory
  
        - name: Deploy app
          git: repo=git@bitbucket.org:YAmikep/djangotutorial.git dest=/home/deploy/code
  </code></pre>
  
  <p>Thanks</p>