
If the tempest role is re-run against a host it will fail attempting to re-initialize over an existing workspace. Update the changed_when and failed_when conditions to allow reusing an existing workspace. Also provide the path to the workspace rather than working from within the tempest directory to avoid stderr and stdout being written to logs. Change-Id: Ie88cb72b0d7cd3ef07ab269f2580485a7eeae3c6
113 lines
3.3 KiB
YAML
113 lines
3.3 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Get admin tenant id
|
|
keystone:
|
|
command: get_tenant
|
|
tenant_name: admin
|
|
endpoint: "{{ keystone_service_adminurl }}"
|
|
login_user: "{{ keystone_admin_user_name }}"
|
|
login_password: "{{ keystone_auth_admin_password }}"
|
|
login_project_name: "{{ keystone_admin_tenant_name }}"
|
|
insecure: "{{ keystone_service_adminuri_insecure }}"
|
|
register: add_service
|
|
until: add_service|success
|
|
retries: 5
|
|
delay: 10
|
|
|
|
- name: Store admin tenant id
|
|
set_fact:
|
|
tempest_admin_tenant_id: "{{ keystone_facts.id }}"
|
|
|
|
# TODO(odyssey4me):
|
|
# Remove the creation of the etc and lock directories
|
|
# when all consumers of this role are no longer using
|
|
# the old execution method.
|
|
- name: Create tempest directories
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "{{ item.mode|default('0755') }}"
|
|
with_items:
|
|
- path: "{{ tempest_venv_bin | dirname }}/locks"
|
|
mode: "0777"
|
|
- path: "{{ tempest_log_dir }}"
|
|
- path: "{{ ansible_env.HOME }}/.tempest/etc"
|
|
- path: "{{ tempest_venv_bin | dirname }}/etc"
|
|
- path: "{{ tempest_image_dir }}"
|
|
|
|
- name: Image(s) download
|
|
get_url:
|
|
url: "{{ item.url }}"
|
|
dest: "{{ tempest_image_dir }}"
|
|
sha256sum: "{{ item.sha256 }}"
|
|
with_items: "{{ tempest_images }}"
|
|
when: tempest_service_available_glance | bool
|
|
|
|
# TODO(odyssey4me):
|
|
# Remove the placement to /opt/tempest/etc/ when all
|
|
# consumers of the role are no longer using the old method.
|
|
- name: Copy tempest config
|
|
config_template:
|
|
src: "tempest.conf.j2"
|
|
dest: "{{ item }}"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0644"
|
|
config_overrides: "{{ tempest_tempest_conf_overrides }}"
|
|
config_type: "ini"
|
|
with_items:
|
|
- "{{ tempest_venv_bin | dirname }}/etc/tempest.conf"
|
|
- "{{ ansible_env.HOME }}/.tempest/etc/tempest.conf"
|
|
|
|
- name: Initialise tempest workspace
|
|
shell: |
|
|
if [ ! -d {{ tempest_venv_bin | dirname }}/workspace ]
|
|
then
|
|
. {{ tempest_venv_bin }}/activate
|
|
tempest init {{ tempest_venv_bin | dirname }}/workspace
|
|
exit 3
|
|
fi
|
|
args:
|
|
executable: /bin/bash
|
|
register: tempest_init_workspace
|
|
changed_when: tempest_init_workspace.rc == 3
|
|
failed_when:
|
|
- tempest_init_workspace.rc != 0
|
|
- tempest_init_workspace.rc != 3
|
|
tags:
|
|
# don't trigger ANSIBLE0013
|
|
- skip_ansible_lint
|
|
|
|
- name: Generate tempest test whitelist
|
|
copy:
|
|
content: |
|
|
{% for item in tempest_test_whitelist | unique | sort %}
|
|
{% if item != '' %}
|
|
{{ item }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
dest: "{{ tempest_test_whitelist_file_path }}"
|
|
|
|
- name: Generate tempest Config
|
|
template:
|
|
src: "openstack_tempest_gate.sh.j2"
|
|
dest: "/opt/openstack_tempest_gate.sh"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0755"
|