browbeat/ansible/install/roles/rally/tasks/main.yml

147 lines
4.8 KiB
YAML

---
#
# Browbeat's Rally Install
#
- name: Create rally virtualenv
command: virtualenv --python=python3 {{ rally_venv }} creates={{ rally_venv }}
when: ansible_distribution_major_version <= '8'
- name: Create rally virtualenv
command: python3 -m venv {{ rally_venv }} creates={{ rally_venv }}
when: ansible_distribution_major_version == '9'
- name: Rally Add browbeat to Python path
shell: echo 'export PYTHONPATH=$PYTHONPATH:{{ browbeat_path }}' >> {{ rally_venv }}/bin/activate
- name: Setup rally-venv CA certificate path
lineinfile:
dest: "{{ rally_venv }}/bin/activate"
line: 'export REQUESTS_CA_BUNDLE={{ overcloud_ca_path }}'
when: overcloud_ca_path is defined
- name: Upgrade pip if it is old
shell: |
source "{{ rally_venv }}/bin/activate"
if [ "$(pip --version | cut -d' ' -f2 | cut -d'.' -f1)" -lt "19" ]; then
pip install --upgrade 'pip<20'
fi
args:
executable: /bin/bash
chdir: "{{ browbeat_path }}"
- name: Install rally-requirements into rally-venv
pip:
requirements: "{{ browbeat_path }}/tools-requirements.txt"
virtualenv: "{{ rally_venv }}"
- name: Install Rally with OpenStack plugins into rally-venv
pip:
name: rally-openstack
version: "{{ rally_openstack_version }}"
virtualenv: "{{ rally_venv }}"
# Till https://bugs.launchpad.net/rally/+bug/1922707 fixed
- name: set decorator to 4.4.2
pip:
name: decorator
version: "4.4.2"
virtualenv: "{{ rally_venv }}"
# Till https://bugs.launchpad.net/rally/+bug/2004022 fixed
- name: Ensure SQLAlchemy<2.0.0
pip:
name: 'SQLAlchemy<2.0.0'
virtualenv: "{{ rally_venv }}"
# Till browbeat code is compatible with novaclient-18.3.0
# https://bugs.launchpad.net/openstack-browbeat/+bug/2008235
- name: Ensure python-novaclient<18.3.0
pip:
name: 'python-novaclient<18.3.0'
virtualenv: "{{ rally_venv }}"
- name: Create rally configuration directory
file:
path: "{{ rally_venv }}/etc/rally"
state: directory
- name: Setup rally.conf
template:
src: rally.conf.j2
dest: "{{ rally_venv }}/etc/rally/rally.conf"
- name: Setup rally database
shell: . {{ rally_venv }}/bin/activate; rally db recreate
# Install rally extra code which we develop in browbeat
# as python package. This code can be used in browbeat rally plugins.
# Sqlalchemy giving errors when we run this extra DB code as rally plugin
# so we came up with this python package approach.
- name: install rally browbeat code
shell: |
source {{ rally_venv }}/bin/activate
pip install .
args:
executable: /bin/bash
chdir: "{{ role_path }}/files/browbeat-rally"
when: rhosp_version is version('13.0', '>=')
- name: create lock table in rally db for dynamic workloads
shell: |
source {{ rally_venv }}/bin/activate
python {{ role_path }}/files/create_lock_table.py
when: rhosp_version is version('13.0', '>=')
- block:
- name: copy of stackrc
copy:
src: "{{ stackrc }}"
dest: "{{home_dir}}/undercloudrc"
- name: Get the OS_AUTH_URL value in stackrc
shell: cat {{home_dir}}/undercloudrc | grep OS_AUTH_URL=
register: os_auth_url
when: (rhosp_version is version('17.0', '<'))
- name: Add v3 to OS_AUTH_URL in stackrc
replace:
path: "{{home_dir}}/undercloudrc"
regexp: "{{ os_auth_url.stdout }}"
replace: '{{ os_auth_url.stdout }}/v3'
when: (rhosp_version is version('17.0', '<'))
- name: Add OS_CACERT to undercloudrc
lineinfile:
path: "{{home_dir}}/undercloudrc"
insertafter: "export OS_USER"
line: "export OS_CACERT=/etc/pki/ca-trust/source/anchors/undercloud-cacert.pem"
when: rhosp_version is version('15.0', '>=') and (rhosp_version is version('17.0', '<'))
- name: Setup rally deployment for undercloud
shell: . {{ rally_venv }}/bin/activate; . "{{home_dir}}/undercloudrc"; rally deployment create --fromenv --name undercloud
- name: Check Rally deployment for undercloud
shell: . {{ rally_venv }}/bin/activate; . "{{home_dir}}/undercloudrc"; rally deployment check
register: rally_deployment_check_undercloud
- name: Fail if Rally deployment cannot be verfied on undercloud
fail:
msg: "Failed to verify that your deployment is ready to benchmark"
when: rally_deployment_check_undercloud.rc != 0
when: rally_undercloud_enabled
- name: Setup rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment create --fromenv --name overcloud
- name: Check Rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment check
register: rally_deployment_check_overcloud
- name: Fail if Rally deployment cannot be verfied for overcloud
fail:
msg: "Failed to verify that your deployment is ready to benchmark"
when: rally_deployment_check_overcloud.rc != 0