- name: Install git
  become: yes
  yum:
      name: "git"
      state: present

- name: Create plugins directory
  file:
      state: directory
      path: "{{ plugins_dir }}"

- name: Clone tempest plugin
  environment:
      GIT_SSL_NO_VERIFY: 0
  git:
      repo: "{{ plugin_dict.value.repo | default(plugin_dict.value.default) }}"
      dest: "{{ plugins_dir }}/{{ plugin_dict.key }}"
      accept_hostkey: true
  retries: 3
  delay: 60

- name: Install extra system requirements for tests
  package:
      name: "{{ plugin_dict.value.dependencies }}"
      state: present
  when: plugin_dict.value.dependencies is defined
  become: yes

- block:
    # some repos have "test-requirements" files and some don't.
    - name: Check if test-requirements exists
      stat:
          path: "{{ plugins_dir }}/{{ plugin_dict.key }}/test-requirements.txt"
      register: plugins_reqs

    - name: Get repo requirements
      become: yes
      pip:
          chdir: "~/{{ test.dir }}"
          requirements: "{{ plugins_reqs.stat.path }}"
      when: plugins_reqs.stat.exists

- name: Install plugin packages globally to the system
  become: yes
  pip:
      name: "{{ plugins_dir }}/{{ plugin_dict.key }}"
      state: present
      editable: true

- name: Install git
  become: yes
  yum:
      name: "git"
      state: present

- name: Install pip
  become: yes
  easy_install:
      name: pip
      state: latest

- name: Create plugins directory
  file:
      state: directory
      path: "{{ plugins_dir }}"

- name: Clone tempest plugin
  environment:
      GIT_SSL_NO_VERIFY: 0
  git:
      repo: "{{ plugin_dict.value.repo | default(plugin_dict.value.default) }}"
      dest: "{{ plugins_dir }}/{{ plugin_dict.key }}"
      accept_hostkey: true
  retries: 3
  delay: 60

- name: Install extra system requirements for tests
  package:
      name: "{{ plugin_dict.value.dependencies }}"
      state: present
  when: plugin_dict.value.dependencies is defined
  become: yes

- block:
    # some repos have "test-requirements" files and some don't.
    - name: Check if test-requirements exists
      stat:
          path: "{{ plugins_dir }}/{{ plugin_dict.key }}/test-requirements.txt"
      register: plugins_reqs

    - name: Get repo requirements
      become: yes
      pip:
          chdir: "~/{{ test.dir }}"
          requirements: "{{ plugins_reqs.stat.path }}"
      when: plugins_reqs.stat.exists

- name: Install plugin packages globally to the system
  become: yes
  pip:
      name: "{{ plugins_dir }}/{{ plugin_dict.key }}"
      state: present
      editable: true

Install pip for tempest git plugins
Install pip for tempest git plugins

Added installation of the pip package
for the case when git plugin need to
be installed from the source (package
is missing). This scenario is actual
for the case when tempset setup method
is rpm.

Pip is required in that case to install
plugin requirements

Change-Id: I513e7a1c328098bab5c9c4fc6463c50242cfe538
