---
- name: Install openstack services tempest plugin for newton
  package:
    name:
      - python-ceilometer-tests
      - python-zaqar-tests
      - python-ironic-inspector-tests
      - python-gnocchi-tests
      - python-aodh-tests
      - python-mistral-tests
      - python-heat-tests
      - python-keystone-tests
      - python-ironic-tests
      - python-neutron-tests
      - python-cinder-tests
    state: present
  become: true
  when: release == 'newton'

- name: Install openstack services tempest plugins
  package:
    state: latest
    name: "{{ item | regex_replace( '^python[0-9]*-(.*)$', python_package_prefix + '-\\1' ) }}"
  with_items: "{{ tempest_plugins }}"
  become: true
  when: tempest_plugins|length > 0

- name: Install openstack tempest
  package:
    name:
      - openstack-tempest
      - "{{ python_package_prefix }}-junitxml"
    state: present
  become: true

- name: Install python-tempestconf
  package:
    name: "{{ python_package_prefix }}-tempestconf"
    state: present
  become: true
  when: release != 'newton'

- name: Set tempest init command
  set_fact:
    tempest_init: "{% if release == 'newton' %}/usr/share/openstack-tempest-*/tools/configure-tempest-directory{% else %}tempest init {{ tempest_dir }}{% endif %}"

- name: Set tempestconf call
  set_fact:
    tempestconf: "{% if release == 'newton' %}{{ tempest_dir }}/tools/config_tempest.py{% else %}/usr/bin/discover-tempest-config{% endif %}"
