<p dir="auto">A playbook used for testing:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---

- hosts: all
  remote_user: root

  tasks:                                                                                                                                    
  - debug: msg=&quot;First task&quot;
  - debug: msg=&quot;Second task&quot;"><pre class="notranslate"><code class="notranslate">
---

- hosts: all
  remote_user: root

  tasks:                                                                                                                                    
  - debug: msg="First task"
  - debug: msg="Second task"
</code></pre></div>
<p dir="auto">When run with command <code class="notranslate">ansible-playbook -i inventory -l hostname -k debug.yml</code>, Ansible connects to host as 'root' account, gathers facts, and for subsequent tasks connects to remote host using username from local system which is used to run <code class="notranslate">ansible-playbook</code> (in my case, 'drybjed'). Example output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="drybjed ansible-aiua/ $ ansible-playbook -i inventory -k debug.yml -l philote.aiua -vvv
SSH password: 

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', &quot;/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1382344700.02-43467222883968 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1382344700.02-43467222883968'&quot;]
&lt;philote.aiua&gt; REMOTE_MODULE setup 
&lt;philote.aiua&gt; PUT /tmp/tmpxTVWFf TO /root/.ansible/tmp/ansible-1382344700.02-43467222883968/setup
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', &quot;/bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-1382344700.02-43467222883968/setup; rm -rf /root/.ansible/tmp/ansible-1382344700.02-43467222883968/ &gt;/dev/null 2&gt;&amp;1'&quot;]
ok: [philote.aiua]

TASK: [debug msg=&quot;First task&quot;] ************************************************ 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: drybjed
ok: [philote.aiua] =&gt; {
    &quot;msg&quot;: &quot;First task&quot;
}

TASK: [debug msg=&quot;Second task&quot;] *********************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: drybjed
ok: [philote.aiua] =&gt; {
    &quot;msg&quot;: &quot;Second task&quot;
}

PLAY RECAP ******************************************************************** 
philote.aiua               : ok=3    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">drybjed ansible-aiua/ $ ansible-playbook -i inventory -k debug.yml -l philote.aiua -vvv
SSH password: 

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1382344700.02-43467222883968 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1382344700.02-43467222883968'"]
&lt;philote.aiua&gt; REMOTE_MODULE setup 
&lt;philote.aiua&gt; PUT /tmp/tmpxTVWFf TO /root/.ansible/tmp/ansible-1382344700.02-43467222883968/setup
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', "/bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-1382344700.02-43467222883968/setup; rm -rf /root/.ansible/tmp/ansible-1382344700.02-43467222883968/ &gt;/dev/null 2&gt;&amp;1'"]
ok: [philote.aiua]

TASK: [debug msg="First task"] ************************************************ 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: drybjed
ok: [philote.aiua] =&gt; {
    "msg": "First task"
}

TASK: [debug msg="Second task"] *********************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: drybjed
ok: [philote.aiua] =&gt; {
    "msg": "Second task"
}

PLAY RECAP ******************************************************************** 
philote.aiua               : ok=3    changed=0    unreachable=0    failed=0   
</code></pre></div>
<p dir="auto">When the same playbook is run with command <code class="notranslate">ansible-playbook -i inventory -k -u root -l hostname debug.yml</code>, playbook behaves as expected</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="drybjed ansible-aiua/ $ ansible-playbook -i inventory -k -u root debug.yml -l philote.aiua -vvv
SSH password: 

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', &quot;/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1382344783.69-47258613050074 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1382344783.69-47258613050074'&quot;]
&lt;philote.aiua&gt; REMOTE_MODULE setup 
&lt;philote.aiua&gt; PUT /tmp/tmpbDXxl2 TO /root/.ansible/tmp/ansible-1382344783.69-47258613050074/setup
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', &quot;/bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-1382344783.69-47258613050074/setup; rm -rf /root/.ansible/tmp/ansible-1382344783.69-47258613050074/ &gt;/dev/null 2&gt;&amp;1'&quot;]
ok: [philote.aiua]

TASK: [debug msg=&quot;First task&quot;] ************************************************ 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
ok: [philote.aiua] =&gt; {
    &quot;msg&quot;: &quot;First task&quot;
}

TASK: [debug msg=&quot;Second task&quot;] *********************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
ok: [philote.aiua] =&gt; {
    &quot;msg&quot;: &quot;Second task&quot;
}

PLAY RECAP ******************************************************************** 
philote.aiua               : ok=3    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">drybjed ansible-aiua/ $ ansible-playbook -i inventory -k -u root debug.yml -l philote.aiua -vvv
SSH password: 

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1382344783.69-47258613050074 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1382344783.69-47258613050074'"]
&lt;philote.aiua&gt; REMOTE_MODULE setup 
&lt;philote.aiua&gt; PUT /tmp/tmpbDXxl2 TO /root/.ansible/tmp/ansible-1382344783.69-47258613050074/setup
&lt;philote.aiua&gt; EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/drybjed/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'philote.aiua', "/bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-1382344783.69-47258613050074/setup; rm -rf /root/.ansible/tmp/ansible-1382344783.69-47258613050074/ &gt;/dev/null 2&gt;&amp;1'"]
ok: [philote.aiua]

TASK: [debug msg="First task"] ************************************************ 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
ok: [philote.aiua] =&gt; {
    "msg": "First task"
}

TASK: [debug msg="Second task"] *********************************************** 
&lt;philote.aiua&gt; ESTABLISH CONNECTION FOR USER: root
ok: [philote.aiua] =&gt; {
    "msg": "Second task"
}

PLAY RECAP ******************************************************************** 
philote.aiua               : ok=3    changed=0    unreachable=0    failed=0   
</code></pre></div>
<ul dir="auto">
<li>I'm using current ansible devel from git repository, created using <code class="notranslate">make deb</code></li>
<li>I don't have <code class="notranslate">remote_user</code> variable set in <code class="notranslate">ansible.cfg</code> or inventory.</li>
</ul>
<p dir="auto">Trivial playbook:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- hosts: somelist
  user: root

  tasks:
    - name: test echo
      command: echo {{ item }}
      with_items:
        - foo
        - bar"><pre class="notranslate"><code class="notranslate">
---
- hosts: somelist
  user: root

  tasks:
    - name: test echo
      command: echo {{ item }}
      with_items:
        - foo
        - bar
</code></pre></div>
<p dir="auto">with 1.3.3 both implicit <code class="notranslate">setup</code> and <code class="notranslate">command</code> tasks are run as <em>root</em>. With devel (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ansible/ansible/commit/afa781d628e8ee46da4d2c36cd70ed9366906e92/hovercard" href="https://github.com/ansible/ansible/commit/afa781d628e8ee46da4d2c36cd70ed9366906e92"><tt>afa781d</tt></a> at this moment) the implicit <code class="notranslate">setup</code> task is run as <em>root</em> and the <code class="notranslate">command</code> task is run as the current user.</p>