| 1 |
- block: |
| 2 |
- name: Ensure python-virtualenv is present |
| 3 |
include_role: |
| 4 |
name: ensure-virtualenv |
| 5 |
|
| 6 |
- name: Create python-tempestconf venv with latest pip, setuptools and pbr |
| 7 |
pip: |
| 8 |
virtualenv: "{{ virtualenvs.tempestconf }}" |
| 9 |
virtualenv_python: "{{ tempestconf_pip_virtualenv_python|default(omit) }}" |
| 10 |
name: "{{ item }}" |
| 11 |
state: latest |
| 12 |
with_items: |
| 13 |
- pip |
| 14 |
- setuptools |
| 15 |
- pbr |
| 16 |
|
| 17 |
- name: Debug, list tempestconf dir |
| 18 |
shell: | |
| 19 |
set -ex |
| 20 |
ls -all . |
| 21 |
pwd |
| 22 |
args: |
| 23 |
chdir: "{{ tempestconf_src_relative_path }}" |
| 24 |
|
| 25 |
- name: Install python-tempestconf (with constraints) |
| 26 |
shell: | |
| 27 |
set -ex |
| 28 |
export PATH=$PATH:/usr/local/sbin:/usr/sbin |
| 29 |
source {{ virtualenvs.tempestconf }}/bin/activate |
| 30 |
pip install -c {{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}/upper-constraints.txt . |
| 31 |
args: |
| 32 |
chdir: "{{ tempestconf_src_relative_path }}" |
| 33 |
executable: /bin/bash |
| 34 |
when: branch is defined |
| 35 |
|
| 36 |
- name: Install python-tempestconf |
| 37 |
pip: |
| 38 |
name: "." |
| 39 |
virtualenv: "{{ virtualenvs.tempestconf }}" |
| 40 |
chdir: "{{ tempestconf_src_relative_path }}" |
| 41 |
virtualenv_python: "{{ tempestconf_pip_virtualenv_python|default(omit) }}" |
| 42 |
when: branch is not defined |
| 43 |
|
| 44 |
- name: Generate tempest configuration file |
| 45 |
shell: | |
| 46 |
set -ex |
| 47 |
export PATH=$PATH:/usr/local/sbin:/usr/sbin |
| 48 |
source {{ virtualenvs.tempestconf }}/bin/activate |
| 49 |
printenv |
| 50 |
discover-tempest-config \ |
| 51 |
--out etc/cloud_tempest.conf \ |
| 52 |
--debug \ |
| 53 |
-v \ |
| 54 |
{% if cloud_user == "devstack-admin" %} |
| 55 |
--create \ |
| 56 |
{% else %} |
| 57 |
--non-admin \ |
| 58 |
{% endif %} |
| 59 |
--os-cloud {{ cloud_user }} \ |
| 60 |
auth.tempest_roles Member |
| 61 |
args: |
| 62 |
chdir: "{{ tempestconf_src_relative_path }}" |
| 63 |
executable: /bin/bash |
| 64 |
|
| 65 |
- set_fact: |
| 66 |
profile: |
| 67 |
debug: true |
| 68 |
out: etc/tempest_profile.conf |
| 69 |
verbose: true |
| 70 |
create: "{{ cloud_user == 'devstack-admin' }}" |
| 71 |
non_admin: "{{ cloud_user == 'devstack' }}" |
| 72 |
os_cloud: "{{ cloud_user }}" |
| 73 |
overrides: |
| 74 |
auth.tempest_roles: Member |
| 75 |
|
| 76 |
- name: Generate sample profile.yaml file |
| 77 |
shell: | |
| 78 |
set -ex |
| 79 |
export PATH=$PATH:/usr/local/sbin:/usr/sbin |
| 80 |
source {{ virtualenvs.tempestconf }}/bin/activate |
| 81 |
printenv |
| 82 |
discover-tempest-config \ |
| 83 |
--generate-profile ./etc/profile.yaml |
| 84 |
args: |
| 85 |
chdir: "{{ tempestconf_src_relative_path }}" |
| 86 |
executable: /bin/bash |
| 87 |
|
| 88 |
- name: Edit the profile.yaml file |
| 89 |
copy: |
| 90 |
content: "{{ profile | to_nice_yaml }}" |
| 91 |
dest: "{{ tempestconf_src_relative_path }}/etc/profile.yaml" |
| 92 |
|
| 93 |
- name: Generate tempest configuration file with profile.yaml |
| 94 |
shell: | |
| 95 |
set -ex |
| 96 |
export PATH=$PATH:/usr/local/sbin:/usr/sbin |
| 97 |
source {{ virtualenvs.tempestconf }}/bin/activate |
| 98 |
printenv |
| 99 |
cat ./etc/profile.yaml |
| 100 |
discover-tempest-config \ |
| 101 |
--profile ./etc/profile.yaml |
| 102 |
args: |
| 103 |
chdir: "{{ tempestconf_src_relative_path }}" |
| 104 |
executable: /bin/bash |
| 105 |
|
| 106 |
- name: Compare tempest.conf and tempest_profile.conf |
| 107 |
shell: | |
| 108 |
python3 ./roles/generate-tempestconf-file-cloud/tasks/compare-ini.py ./etc/cloud_tempest.conf ./etc/tempest_profile.conf |
| 109 |
args: |
| 110 |
chdir: "{{ tempestconf_src_relative_path }}" |
| 111 |
|
| 112 |
- name: Print generated tempest.conf |
| 113 |
shell: | |
| 114 |
set -ex |
| 115 |
cat {{ tempestconf_src_relative_path }}/etc/cloud_tempest.conf |
| 116 |
|
| 117 |
vars: |
| 118 |
tempestconf_src_relative_path: "{{ zuul.projects['opendev.org/openinfra/python-tempestconf'].src_dir }}" |