Automatic Tempest Configuration Generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

118 lines
3.7 KiB

- block:
- name: Ensure python-virtualenv is present
include_role:
name: ensure-virtualenv
- name: Create python-tempestconf venv with latest pip, setuptools and pbr
pip:
virtualenv: "{{ virtualenvs.tempestconf }}"
virtualenv_python: "{{ tempestconf_pip_virtualenv_python|default(omit) }}"
name: "{{ item }}"
state: latest
with_items:
- pip
- setuptools
- pbr
- name: Debug, list tempestconf dir
shell: |
set -ex
ls -all .
pwd
args:
chdir: "{{ tempestconf_src_relative_path }}"
- name: Install python-tempestconf (with constraints)
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
pip install -c {{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}/upper-constraints.txt .
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
when: branch is defined
- name: Install python-tempestconf
pip:
name: "."
virtualenv: "{{ virtualenvs.tempestconf }}"
chdir: "{{ tempestconf_src_relative_path }}"
virtualenv_python: "{{ tempestconf_pip_virtualenv_python|default(omit) }}"
when: branch is not defined
- name: Generate tempest configuration file
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
printenv
discover-tempest-config \
--out etc/cloud_tempest.conf \
--debug \
-v \
{% if cloud_user == "devstack-admin" %}
--create \
{% else %}
--non-admin \
{% endif %}
--os-cloud {{ cloud_user }} \
auth.tempest_roles Member
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
- set_fact:
profile:
debug: true
out: etc/tempest_profile.conf
verbose: true
create: "{{ cloud_user == 'devstack-admin' }}"
non_admin: "{{ cloud_user == 'devstack' }}"
os_cloud: "{{ cloud_user }}"
overrides:
auth.tempest_roles: Member
- name: Generate sample profile.yaml file
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
printenv
discover-tempest-config \
--generate-profile ./etc/profile.yaml
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
- name: Edit the profile.yaml file
copy:
content: "{{ profile | to_nice_yaml }}"
dest: "{{ tempestconf_src_relative_path }}/etc/profile.yaml"
- name: Generate tempest configuration file with profile.yaml
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
printenv
cat ./etc/profile.yaml
discover-tempest-config \
--profile ./etc/profile.yaml
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
- name: Compare tempest.conf and tempest_profile.conf
shell: |
python3 ./roles/generate-tempestconf-file-cloud/tasks/compare-ini.py ./etc/cloud_tempest.conf ./etc/tempest_profile.conf
args:
chdir: "{{ tempestconf_src_relative_path }}"
- name: Print generated tempest.conf
shell: |
set -ex
cat {{ tempestconf_src_relative_path }}/etc/cloud_tempest.conf
vars:
tempestconf_src_relative_path: "{{ zuul.projects['opendev.org/openinfra/python-tempestconf'].src_dir }}"