ansible-role-refstack-client/tasks/install-refstack-client.yaml
lkuchlan bb3a6f2f07 Add support for tempest plugins
This patch allows installation of tempest plugins
by using "refstack_tempest_plugins" parameter.

Change-Id: Ibb0c5381b0f63e9663ecc84f3d24a448450e2b38
2021-02-25 12:00:11 +02:00

61 lines
2.0 KiB
YAML

---
- name: Check if refstack_client_source dir exists and if it's empty
find:
paths: "{{ refstack_client_source }}"
register: local_refstack_found
- debug:
var: refstack_client_source
- name: Clone refstack-client
git:
repo: 'https://github.com/openstack/refstack-client.git'
dest: "{{ refstack_client_source }}"
version: "{{ refstack_client_version }}"
when: local_refstack_found.matched == 0
- name: Look for python3
command: "python3 --version"
ignore_errors: true
register: python3_is_available
changed_when: false
- name: Set python3 params for setup_env
set_fact:
python3_param: "-p 3"
when: python3_is_available.rc == 0
- when: refstack_tempest_plugins is defined
block:
# refstack-client allows installation of additional packages to find more
# tests by tempest. The additional tempest plugins should be defined in
# "tempest-additional-requirements.txt" file. This block enables this
# option by using "refstack_tempest_plugins" parameter.
# Usage:
# refstack_tempest_plugins: ===> refstack_tempest_plugins:
# <tempest_plugin_name>:<tag/branch> ===> manila:1.3.0
- name: Add additional requirements for external test suites
replace:
path: "{{ refstack_client_source }}/setup_env"
regexp: '#(.*tempest-additional-requirements.txt$)'
replace: '\1'
- name: Add tempest plugins to tempest-additional-requirements.txt
lineinfile:
path: "{{ refstack_client_source }}/tempest-additional-requirements.txt"
line: "git+https://opendev.org/openstack/{{ item.key }}-tempest-plugin.git@{{ item.value }}"
with_dict: "{{ refstack_tempest_plugins }}"
- name: Install refstack-client
shell: >
./setup_env {{ python3_param | default('') }}
{% if tempest_tag is defined %}
-t {{ tempest_tag }}
{% endif %}
{% if tempestconf_source is defined %}
-s {{ tempestconf_source }}
{% endif %}
args:
chdir: "{{ refstack_client_source }}"
changed_when: true