title: Ansible/Yaml -- conditionally become another user
body: <p>I have the following use case. A user runs an ansible play book and provides a user (with -e user=). In the playbook, as expected, I do become and become_user. However, I want to do this only when the username provided differs from his own username (which is statically known).</p>
  
  <p>I tried to conditionally include a file, where I will do the become, but this didn't seem to work so far. </p>
  
  <p>Here is some of my code:</p>
  
  <p>First/playbook file:</p>
  
  <pre><code>---
  - name: example
  hosts: examplehost
  tasks:
    - include: "usersetup.yml"
      when: "{{ user }} != {{ user_id }}"
  </code></pre>
  
  <p>Second file (usersetup.yml)</p>
  
  <p>I am unclear about the format of this file, since I am relatively new to the process, but I currently have:</p>
  
  <pre><code>- become: yes
  - become_user: "{{ user }}"
  </code></pre>
  
  <p>This doesn't work of course, so any ideas/suggestions welcome. I would be more than happy to provide more clarifications if required. Thanks.</p>