<p dir="auto">Issue Type:</p>
<p dir="auto">Bug Report</p>
<p dir="auto">Ansible Version:</p>
<p dir="auto">Working on</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.0.0 (detached HEAD e2ddc2f6ab) last updated 2015/11/30 18:18:21 (GMT -700)
  lib/ansible/modules/core: (detached HEAD 0e043f8c58) last updated 2015/11/30 18:17:43 (GMT -700)
  lib/ansible/modules/extras: (detached HEAD e46e2e1d6f) last updated 2015/11/30 16:37:19 (GMT -700)
"><pre class="notranslate"><code class="notranslate">ansible 2.0.0 (detached HEAD e2ddc2f6ab) last updated 2015/11/30 18:18:21 (GMT -700)
  lib/ansible/modules/core: (detached HEAD 0e043f8c58) last updated 2015/11/30 18:17:43 (GMT -700)
  lib/ansible/modules/extras: (detached HEAD e46e2e1d6f) last updated 2015/11/30 16:37:19 (GMT -700)

</code></pre></div>
<p dir="auto">Doesn't work on:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.0.0 (stable-2.0 204e27ca66) last updated 2015/11/30 16:38:33 (GMT -700)
  lib/ansible/modules/core: (detached HEAD 273112c56d) last updated 2015/11/30 16:52:55 (GMT -700)
  lib/ansible/modules/extras: (detached HEAD e46e2e1d6f) last updated 2015/11/30 16:37:19 (GMT -700)"><pre class="notranslate"><code class="notranslate">ansible 2.0.0 (stable-2.0 204e27ca66) last updated 2015/11/30 16:38:33 (GMT -700)
  lib/ansible/modules/core: (detached HEAD 273112c56d) last updated 2015/11/30 16:52:55 (GMT -700)
  lib/ansible/modules/extras: (detached HEAD e46e2e1d6f) last updated 2015/11/30 16:37:19 (GMT -700)
</code></pre></div>
<p dir="auto">and doesn't work on</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.0.0 (devel dc0fae1af7) last updated 2015/11/30 16:37:03 (GMT -700)
  lib/ansible/modules/core: (detached HEAD 0e043f8c58) last updated 2015/11/30 18:17:43 (GMT -700)
  lib/ansible/modules/extras: (detached HEAD e46e2e1d6f) last updated 2015/11/30 16:37:19 (GMT -700)
"><pre class="notranslate"><code class="notranslate">ansible 2.0.0 (devel dc0fae1af7) last updated 2015/11/30 16:37:03 (GMT -700)
  lib/ansible/modules/core: (detached HEAD 0e043f8c58) last updated 2015/11/30 18:17:43 (GMT -700)
  lib/ansible/modules/extras: (detached HEAD e46e2e1d6f) last updated 2015/11/30 16:37:19 (GMT -700)

</code></pre></div>
<p dir="auto">Ansible Configuration:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
remote_user=root
transport=ssh
[ssh_connection]
ssh_args=-o StrictHostKeyChecking=true"><pre class="notranslate"><code class="notranslate">[defaults]
remote_user=root
transport=ssh
[ssh_connection]
ssh_args=-o StrictHostKeyChecking=true
</code></pre></div>
<p dir="auto">Environment:</p>
<p dir="auto">Centos 6</p>
<p dir="auto">Summary:</p>
<p dir="auto">Delegate to causing ssh key error</p>
<p dir="auto">Steps To Reproduce:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- name: testing delegate to
  hosts: host1
  gather_facts: false
  tasks:
     - name: attempting to do a shell ls
       shell: ls
       delegate_to: delhost"><pre class="notranslate"><code class="notranslate">
---
- name: testing delegate to
  hosts: host1
  gather_facts: false
  tasks:
     - name: attempting to do a shell ls
       shell: ls
       delegate_to: delhost
</code></pre></div>
<p dir="auto">Expected Results:</p>
<p dir="auto">ls of home dir of delhost</p>
<p dir="auto">Actual Results:</p>
<p dir="auto">ssh error saying key errors looks like it can't connect to delhost but I'm not sure. I know that I can ssh normally to delhost</p>
<p dir="auto">Issue Type: Bug Report (2.0 regression)<br>
Ansible Version: 2.0.0 (devel)<br>
Ansible Configuration: default<br>
Environment: Ubuntu 14.04<br>
Summary:<br>
delegate_to does not use user specified with remote_user.</p>
<p dir="auto">Steps To Reproduce:<br>
Following playbook works correctly on 1.9.4 with output root and on devel it outputs normal user.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- hosts:
    - test-vm
  become: yes

  tasks:
  - command: whoami
    register: whoami
    delegate_to: &quot;test-vm2&quot;
    remote_user: root
    become: false

  - debug: msg=&quot;{{ whoami.stdout }}&quot;"><pre class="notranslate"><code class="notranslate">
---
- hosts:
    - test-vm
  become: yes

  tasks:
  - command: whoami
    register: whoami
    delegate_to: "test-vm2"
    remote_user: root
    become: false

  - debug: msg="{{ whoami.stdout }}"
</code></pre></div>
<p dir="auto">Expected Results:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [test] =&gt; {
    &quot;changed&quot;: false, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;msg&quot;: &quot;root&quot;
        }, 
        &quot;module_name&quot;: &quot;debug&quot;
    }, 
    &quot;msg&quot;: &quot;root
}
"><pre class="notranslate"><code class="notranslate">ok: [test] =&gt; {
    "changed": false, 
    "invocation": {
        "module_args": {
            "msg": "root"
        }, 
        "module_name": "debug"
    }, 
    "msg": "root
}

</code></pre></div>
<p dir="auto">Actual Results:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [test] =&gt; {
    &quot;changed&quot;: false, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;msg&quot;: &quot;username&quot;
        }, 
        &quot;module_name&quot;: &quot;debug&quot;
    }, 
    &quot;msg&quot;: &quot;username&quot;
}"><pre class="notranslate"><code class="notranslate">ok: [test] =&gt; {
    "changed": false, 
    "invocation": {
        "module_args": {
            "msg": "username"
        }, 
        "module_name": "debug"
    }, 
    "msg": "username"
}
</code></pre></div>