---
- name: install virtualenv requirments for pip
  become: yes
  package:
      name:
        - gcc
        - python-devel
        - python-setuptools
        - libffi-devel
      state: present

- name: install pip
  become: yes
  easy_install:
      name: pip

- name: install virtualenv pip module
  pip:
      name: virtualenv
      state: forcereinstall
      extra_args: --user

# required to avoid any conflicts in venv with
# different packages versions (especially shade)
- name: cleanup shade venv if present
  file:
      state: absent
      path: "{{ shade_path_venv }}"

# installing setuptools and pip must happen before other packages and separated
# do not use shimming for these two special packages
- name: shade virtualenv core deps
  pip:
      name: "{{ item }}"
      virtualenv: "{{ shade_path_venv }}"
      virtualenv_command: "{{ ansible_env.HOME }}/.local/bin/virtualenv"
  with_items:
    - setuptools>=39.0.0
    - pip>=10.0.1

- name: shade virtualenv deps
  pip:
      name:
        - pytz==2016.4
        - cmd2==0.8.6
        - shade>=1.25
      # TODO: unpin shade to avoid other conflicts
      virtualenv: "{{ shade_path_venv }}"
      virtualenv_command: "{{ ansible_env.HOME }}/.local/bin/virtualenv"

---
- name: install virtualenv requirments for pip
  become: yes
  package:
      name:
        - gcc
        - python-devel
        - python-setuptools
        - libffi-devel
      state: present

- name: install pip
  become: yes
  easy_install:
      name: pip

- name: install virtualenv pip module
  pip:
      name: virtualenv
      state: forcereinstall
      extra_args: --user

# required to avoid any conflicts in venv with
# different packages versions (especially shade)
- name: cleanup shade venv if present
  become: yes
  file:
      state: absent
      path: "{{ shade_path_venv }}"

# installing setuptools and pip must happen before other packages and separated
# do not use shimming for these two special packages
- name: shade virtualenv core deps
  pip:
      name: "{{ item }}"
      virtualenv: "{{ shade_path_venv }}"
      virtualenv_command: "{{ ansible_env.HOME }}/.local/bin/virtualenv"
  with_items:
    - setuptools>=39.0.0
    - pip>=10.0.1

- name: shade virtualenv deps
  pip:
      name:
        - pytz==2016.4
        - cmd2==0.8.6
        - shade>=1.25
      # TODO: unpin shade to avoid other conflicts
      virtualenv: "{{ shade_path_venv }}"
      virtualenv_command: "{{ ansible_env.HOME }}/.local/bin/virtualenv"

Fix for shade cleanup, fails on permission denied
Fix for shade cleanup, fails on permission denied

[Errno 13] Permission denied: '/var/tmp/venv_shade/lib/python2.7/config'

Change-Id: I9bcf84f666d52c2d52f8a4936c8469f3fd068e4e
