ansible-role-refstack-client/tasks/install-refstack-client.yaml

73 lines
2.4 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://opendev.org/osf/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
- name: Clone py2 python-tempestconf
git:
repo: 'https://git.openstack.org/osf/python-tempestconf.git'
dest: "{{ refstack_client_source }}/.tempestconf_source"
version: "2.5.0"
when:
- python3_is_available.rc != 0
- tempestconf_source is not defined
- 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 %}
{% if tempestconf_source is not defined and python3_is_available.rc != 0 %}
-s {{ refstack_client_source }}/.tempestconf_source
{% endif %}
args:
chdir: "{{ refstack_client_source }}"
changed_when: true