title: Ansible and "sudo su -"
body: <p>I have some machines where I log with the main account and after that I can execute "sudo su -" without a password if there is a need.
  Do you know any way in Ansible to execute "sudo su -" after I log in to my primary account? Thanks in advance.</p>
  
  <p>What I was trying in example 
  play.yml:</p>
  
  <pre><code>---
  - hosts: b1
    remote_user: user
    become: yes
    tasks:
       - name: who
         shell: whoami &gt;&gt; file.txt
  </code></pre>
  
  <p>Also added this to Ansible hosts file:</p>
  
  <pre><code>host ansible_ssh_host=7.7.7.7 ansible_become_method=su ansible_become_exe="sudo su -"
  </code></pre>
  
  <p>When I execute playbook with -k argument it asks for my pass, however, it doesn't become root later on.</p>