/home/zuul/src/opendev.org/openstack/openstack-ansible-os_tempest/tasks/tempestconf.yml
---
# 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
  import_role:
    name: "python_venv_build"
  vars:
    venv_build_constraints: "{{ tempest_tempestconf_git_constraints }}"
    venv_install_destination_path: "{{ tempest_tempestconf_venv_bin | dirname }}"
    venv_pip_install_args: "{{ tempest_pip_install_args }}"
    venv_pip_packages: "{{ tempest_tempestconf_pip_packages }}"
  when: tempest_install_method == 'source'

- name: Override tempestconf profile
  copy:
    content: "{{ tempest_tempestconf_profile | to_nice_yaml }}"
    dest: "{{ tempest_workspace }}/etc/profile.yaml"

- name: Executing python-tempestconf
  shell: |
    set -e
    if [ -d {{ tempest_tempestconf_venv_bin }} ]; then
    . {{ tempest_tempestconf_venv_bin }}/activate
    fi
    discover-tempest-config --profile "{{ tempest_workspace }}/etc/profile.yaml"
  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