--- # Copyright Red Hat, Inc. # All Rights Reserved. # # 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: Ensure podman is installed become: true ansible.builtin.package: name: podman state: present - name: Create tempest directories ansible.builtin.file: path: "{{ cifmw_tempest_artifacts_basedir }}" state: directory mode: "0755" - name: Setup tempest tests ansible.builtin.include_tasks: tempest-tests.yml - name: Create clouds.yaml ansible.builtin.include_tasks: create-clouds-file.yml when: not cifmw_tempest_dry_run | bool - name: Configure tempest ansible.builtin.include_tasks: configure-tempest.yml when: not cifmw_tempest_dry_run | bool - name: Copy CA bundle to cifmw_tempest_artifacts_basedir ansible.builtin.copy: src: "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" dest: "{{ cifmw_tempest_artifacts_basedir }}" mode: '0444' owner: "{{ ansible_user | default(lookup('env', 'USER')) }}" group: "{{ ansible_user | default(lookup('env', 'USER')) }}" remote_src: true - name: Set proper permission for tempest directory ansible.builtin.command: cmd: "podman unshare chown 42480:42480 -R {{ cifmw_tempest_artifacts_basedir }}" when: not cifmw_tempest_dry_run | bool - name: Ensure we have tempest container image register: _tempest_fetch_img containers.podman.podman_image: name: "{{ cifmw_tempest_image }}:{{ cifmw_tempest_image_tag }}" retries: 5 delay: 5 until: _tempest_fetch_img is success - name: Run tempest ignore_errors: true containers.podman.podman_container: name: tempest image: "{{ cifmw_tempest_image }}:{{ cifmw_tempest_image_tag }}" state: started auto_remove: "{{ cifmw_tempest_remove_container }}" network: host volume: - "{{ cifmw_tempest_artifacts_basedir }}/:/var/lib/tempest/external_files:Z" - "{{ cifmw_tempest_artifacts_basedir }}/tls-ca-bundle.pem:/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:Z" detach: false dns: "{{ cifmw_tempest_dns_servers }}" env: CONCURRENCY: "{{ cifmw_tempest_concurrency | default(omit) }}" when: not cifmw_tempest_dry_run | bool register: tempest_run_output - name: Change tempest directory permission back to original become: true ansible.builtin.file: path: "{{ cifmw_tempest_artifacts_basedir }}" state: directory recurse: true owner: "{{ ansible_user | default(lookup('env', 'USER')) }}" group: "{{ ansible_user | default(lookup('env', 'USER')) }}" - name: Save logs from podman when: not cifmw_tempest_dry_run | bool ansible.builtin.copy: mode: "0644" dest: "{{ cifmw_tempest_artifacts_basedir }}/podman_tempest.log" content: | "{{ tempest_run_output.stdout }}" - name: Fail if podman container did not succeed when: not cifmw_tempest_dry_run | bool ansible.builtin.assert: that: - "tempest_run_output.failed == false"