title: Struggling to switch to root user with Ansible
body: <p>I'm a beginner with Ansible, and I need to run some basic tasks on a remote server.</p>
  
  <p>The procedure is as follows:</p>
  
  <ul>
  <li>I log as some user (osadmin)</li>
  <li>I run <code>su -</code> to become root</li>
  <li>I then do the tasks I need to.</li>
  </ul>
  
  <p>So, I wrote my playbook as follows:</p>
  
  <pre><code>---
  - name: Some tasks
    become: yes
    become_user: root
    # become_method: su // Also tried with that.
    template: src=repo.j2 dest=/etc/yum.repos.d/test.repo owner=root group=root
    register: copy
  </code></pre>
  
  <p>Also, I have the following in <code>vars/main.yml</code>:</p>
  
  <pre><code>ansible_user: osadmin
  ansible_password: password1
  ansible_become_password: password2
  [ some other values ]
  </code></pre>
  
  <p>However, when running my tasks, Ansible / the hosts returns me the following:</p>
  
  <blockquote>
    <p>"Incorrect sudo password"</p>
  </blockquote>
  
  <p>While I'm sure I gave it the right password. So, I guess I'm not doing this correctly.</p>
  
  <p>What would be the correct way to switch to root via <code>su</code>?</p>
  
  <p>Thank you in advance</p>