title: Ansible - Activating virtual env with become_user
body: <p>I want to do create a user for my CKAN installation and then activate a virtual environment as the user and install something.</p>
  
  <pre><code>- name: Add a CKAN user
    user:
      name: ckan
      comment: "CKAN User"
      shell: /sbin/nologin
      create_home: yes
      home: /usr/lib/ckan
      state: present 
  
  - name: chmod 755 /usr/lib/ckan
    file:
      path: /usr/lib/ckan
      mode: u=rwX,g=rX,o=rX
      recurse: yes
  
  - name: Create Python virtual env
    command: virtualenv --no-site-packages default 
    become: yes
    become_user: ckan
  
  - name: Activate env
    command: . default/bin/activate
  
  - name: Activate env
    command: pip install setuptools==36.1
  </code></pre>
  
  <p>I know it's generally not the most 'Ansible' implementation but I'm just trying to get something to work. </p>
  
  <p>The error is in 'Create Python virtual env'. I am getting an error in that line for </p>
  
  <p>In a command line I would just run:
  su -s /bin/bash - ckan</p>
  
  <p>But how do I achieve this here? I thought become_user would do it?</p>