Files
python-tempestconf/roles/generate-tempestconf-file/tasks/main.yaml
Chandan Kumar 34f030b5a2 Use --non-admin for non admin users in zuul jobs
python-tempestconf-tempest-packstack/devstack-demo zuul job
uses generate-tempestconf-file role to generate tempest.conf.
Since demo is a non-admin user with non-admin user we cannot use
--create option but it was used since it is a bug, so we need to
check for admin/demo user then enable the proper option.

Used Jinja templates for creating tempest configuration script

Create test-demo-user role which prepares resources for a demo
user.
Create generate-accounts-file role, which generates accounts.yaml
file for Tempest needed for running tests as user who doesn't
have persmissions to create resources.

Change-Id: I727a6cfd154cb3f95c33da02440f25ae1765153f
Story: #2001695
Co-Authored-By: Martin Kopec <mkopec@redhat.com>
2018-04-20 21:16:54 +00:00

76 lines
2.1 KiB
YAML

- block:
- debug:
var: source_credentials_commands
- name: Create python-tempestconf venv with latest pip, setuptools and pbr
pip:
virtualenv: "{{ virtualenvs.tempestconf }}"
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
pip:
name: "."
virtualenv: "{{ virtualenvs.tempestconf }}"
chdir: "{{ tempestconf_src_relative_path }}"
- name: "Cat keystonerc_ file (only in packstack case)"
shell: |
set -ex
cat {{ ansible_user_dir }}/keystonerc_{{ user }}
ignore_errors: True
args:
executable: /bin/bash
- name: Generate tempest configuration script
template:
src: generate-tempestconf.sh.j2
dest: "{{ tempestconf_src_relative_path }}/generate-tempestconf.sh"
mode: 0744
- include: test-demo-user.yaml
when: test_demo_user
- name: Generate tempest configuration filea
shell: |
./generate-tempestconf.sh
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
- name: Print generated tempest.conf
shell: |
set -x
ls /opt/stack/tempest/etc
cat {{ tempestconf_src_relative_path }}/etc/tempest.conf
# tempest role which will run tests has tempest in {{ devstack_base_dir }}
# location, therefore the file is copied there
- name: Copy tempest.conf to the tempest directory
shell: |
set -x
cp {{ tempestconf_src_relative_path }}/etc/tempest.conf {{ devstack_base_dir }}/tempest/etc/tempest.conf
when: output_path is not defined
- name: Copy tempest.conf to the specified location
become: yes
shell: |
set -x
cp {{ tempestconf_src_relative_path }}/etc/tempest.conf {{ output_path }}
when: output_path is defined
vars:
tempestconf_src_relative_path: "{{ zuul.projects['git.openstack.org/openstack/python-tempestconf'].src_dir }}"