title: Unable to switch to a different user using become_user
body: <p>I am writing Ansible playbook to create key-based ssh access on several hosts with a particular user.
  I have following servers:</p>
  
  <ol>
  <li><p>automation_host</p></li>
  <li><p>Master</p></li>
  <li><p>Slave1</p></li>
  <li><p>Slave2</p></li>
  </ol>
  
  <p>From automation host I will trigger Ansible to run the playbook which should first login to master with user1, then switch to user2, create ssh keys with user2 and copy the id_rsa.pub to slave nodes.</p>
  
  <p>Inventory file contents:</p>
  
  <pre><code>[master]
  172.xxx.xxx.xxx
  [slaves]
  172.xxx.xxx.xxx
  172.xxx.xxx.xxx
  [all:vars]
  ansible_connection=ssh
  ansible_ssh_user=user1
  </code></pre>
  
  <p>playbook.yml file:</p>
  
  <pre><code>- hosts: master
    become_user: user2
    become: yes
    roles:
       - name: passwordless-ssh
  </code></pre>
  
  <p>User2 is available on all hosts (except automation_host) and is added in <code>sudoers</code> as well.</p>
  
  <p>In the passwordless-ssh role, I have added the lines included below to check which user is currently executing the tasks.</p>
  
  <pre><code>- name: get the username running the deploy
    local_action: command whoami
    register: username_on_the_host
  
  - debug: var=username_on_the_host
  </code></pre>
  
  <p>Debug message shows user1 ( I am expecting it to be user2)
  ansible version: 2.5.2</p>
  
  <p>I am very new to Ansible.</p>