Ansible correct way to get a virtualenv with a recent version of setuptools and pip
Question: Hello today to get a virtualenv runing with vagrant (1.7.4)

I first install `python-virtualenv` with apt::

    
    
    - name: Apt install
      apt: name={{ item }} state=installed update_cache=yes
      with_items:
        ## needed to make virtualenv
        - python-dev
        - python-setuptools
        - python-virtualenv
    

The with eassy_install I get pip::

    
    
    - easy_install: name=pip
    

I create virtualenv with `shell:`:

    
    
    - name: == Create virtualenv
      shell: virtualenv "{{ venv_name }}"
      args:
        chdir: "{{ home }}"
      sudo: true
      sudo_user: "{{ user }}"
    
    - name: Upgrade pip wheel and setuptools
      pip: name={{ item }} virtualenv="{{ home }}/{{ venv_name }}"
           extra_args='--upgrade'
      with_items:
        - pip
        - wheel
        - setuptools
    

And End with pip giving the virtualenv info::

    
    
    - name: pip Install packages into virtualenv
      pip: >
        name={{ item }} virtualenv="{{ home }}/{{ venv_name }}"
        virtualenv_site_packages="no"
      with_items:
        - ansicolors
        - blist
    

Is that the correct way to get a virtualenv with a recent version of
setuptools and pip ?:

    
    
    (venv)toto@vagrant-ubuntu-wily-64:~$ python -c "import pkg_resources as pkg; print(pkg.require(['setuptools'])[0].version)"
    20.10.1
    (venv)toto@vagrant-ubuntu-wily-64:~$ pip -V
    pip 8.1.1 from /home/toto/venv/local/lib/python2.7/site-packages (python 2.7)
    (venv)toto@vagrant-ubuntu-wily-64:~$ wheel version
    wheel 0.29.0
    (venv)toto@vagrant-ubuntu-wily-64:~$
    


Answer: You can require the latest version:

    
    
    - name: Upgrade pip wheel and setuptools
      pip: name={{ item }} virtualenv="{{ home }}/{{ venv_name }}" state=latest
           extra_args='--upgrade'
      with_items:
        - pip
        - wheel
        - setuptools
    
    - name: pip Install packages into virtualenv
      pip: >
        name={{ item }} virtualenv="{{ home }}/{{ venv_name }}" state=latest
        virtualenv_site_packages="no"
      with_items:
        - ansicolors
        - blist
    

