diff --git a/defaults/main.yml b/defaults/main.yml index dcfbf148..4c136c38 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -267,6 +267,15 @@ tempest_role_project_group: utility_all ## Tunable overrides tempest_tempest_conf_overrides: {} +# python-tempestconf variables +# The tempest_use_tempestconf by default is set to false, set to true if you +# want to generate the tempest.conf file with this tool, instead of +# tempest.conf from the template +tempest_use_tempestconf: false +tempest_tempestconf_venv_bin: "/openstack/venvs/tempestconf/bin" +tempest_tempestconf_pip_packages: + - python-tempestconf + # Stackviz tarball url stackviz_tarball: "https://tarballs.openstack.org/package-stackviz-element/stackviz-latest.tar.gz" stackviz_venv_bin: "/openstack/venvs/stackviz/bin" diff --git a/releasenotes/notes/enable-tempestconf-support-0bd13c8393c9450b.yaml b/releasenotes/notes/enable-tempestconf-support-0bd13c8393c9450b.yaml new file mode 100644 index 00000000..d7a9dccd --- /dev/null +++ b/releasenotes/notes/enable-tempestconf-support-0bd13c8393c9450b.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Python-tempestconf is a tool that generates a tempest.conf file, based + only on the credentials from an openstack installation. It uses the + discoverable api from openstack to check for services, features, etc. + + Add the possibility to use python-tempestconf tool to generate tempest.conf + file, rather than use the role template. diff --git a/tasks/tempest_post_install.yml b/tasks/tempest_post_install.yml index 060a0bd9..21ab9f94 100644 --- a/tasks/tempest_post_install.yml +++ b/tasks/tempest_post_install.yml @@ -36,6 +36,7 @@ mode: "0644" config_overrides: "{{ tempest_tempest_conf_overrides }}" config_type: "ini" + when: not tempest_use_tempestconf | bool - name: Initialise tempest workspace shell: | @@ -58,6 +59,12 @@ # don't trigger ANSIBLE0013 - skip_ansible_lint +- include_tasks: tempestconf.yml + when: tempest_use_tempestconf | bool + tags: + - tempest-config + - tempestconf + - name: List installed tempest plugins shell: | set -e diff --git a/tasks/tempestconf.yml b/tasks/tempestconf.yml new file mode 100644 index 00000000..7ab2f7cd --- /dev/null +++ b/tasks/tempestconf.yml @@ -0,0 +1,49 @@ +--- +# Copyright 2018, Red Hat 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: Install python-tempestconf on venv + include_role: + name: "python_venv_build" + vars: + venv_install_destination_path: "{{ tempest_tempestconf_venv_bin | dirname }}" + venv_pip_install_args: "--isolated" + venv_pip_packages: "{{ tempest_tempestconf_pip_packages }}" + +- name: Executing python-tempestconf + shell: | + . {{ tempest_tempestconf_venv_bin }}/activate + export OS_AUTH_URL="{{ keystone_service_internaluri }}" + export OS_IDENTITY_API_VERSION="3" + export OS_USERNAME="{{ keystone_admin_user_name }}" + export OS_PROJECT_NAME="{{ keystone_admin_tenant_name }}" + discover-tempest-config --out etc/tempest.conf \ + --network-id "{{ tempest_neutron_public_network_id }}" \ + --debug \ + --create \ + auth.use_dynamic_credentials true + environment: + OS_PASSWORD: "{{ keystone_auth_admin_password }}" + args: + chdir: "{{ tempest_workspace }}" + executable: /bin/bash + tags: + # don't trigger ANSIBLE0013 + - skip_ansible_lint + +- name: Copy tempest.conf to /etc/tempest + copy: + src: "{{ tempest_workspace }}/etc/tempest.conf" + dest: "/etc/tempest/tempest.conf" + remote_src: yes