title: What user will Ansible run my commands as?
body: <h2>Background</h2>
  
  <p>My question seems simple, but it gets more complex really fast.</p>
  
  <p>Basically, I got really tired of maintaining my servers manually <em>(screams in background)</em> and I decided it was time to find a way to make being a server admin much more liveable. That's when I found Ansible. Great huh? Sure beats making bash scripts <em>(louder scream)</em> for everything I wanted to automate.</p>
  
  <h2>What's the problem?</h2>
  
  <p>I'm having a lot of trouble figuring out what user my Ansible playbook will run certain things as. I also need the ability to specify what user certain tasks will run as. Here are some specific use cases:</p>
  
  <h3>Cloning a repo as another user:</h3>
  
  <p>My purpose with this is it run my node.js webapp from another user, who we'll call <em>bill</em> (that can only use sudo to run a script that I made that starts the node server, as opposed to root or my user that can use sudo for all commands). To do this, I need the ability to have Ansible's git module clone my git repo as <em>bill</em>. How would I do that?</p>
  
  <h3>Knowing how Ansible will gain root:</h3>
  
  <p>As far as I understand, you can set what user Ansible will connect to the server you're maintaining by defining 'user' and the beginning of the playbook file. Here's what I don't understand: if I tell it to connect via my username, <em>joe</em>, and ask it to update a package via the apt module, how will it gain root? Sudo usually prompts me for my password, and I'd prefer keeping it that way (for security).</p>
  
  <h2>Final request</h2>
  
  <p>I've scoured the Ansible docs, done some (what I thought was thorough) Googling, and generally just tried to figure it out on my own, but this information continues to elude me.</p>
  
  <p>I am very new to Ansible, and while it's mostly straight-forwards, I would benefit greatly if I could understand exactly how Ansible runs, on which users it runs, and how/where I can specify what user to use at different times.</p>
  
  <p>Thank you tons in advance</p>