--- # 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: Gather facts if they don't exist ansible.builtin.setup: gather_subset: min when: "'distribution' not in ansible_facts" tags: - always # "{{ role_name }}" will search for and load any operating system variable file # found within the "vars/" path. If no OS files are found the task will skip. - name: Gather variables for each operating system ansible.builtin.include_vars: "{{ item }}" with_first_found: - skip: true files: - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml" - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" - "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" - "{{ ansible_facts['distribution'] | lower }}.yml" - "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml" - "{{ ansible_facts['os_family'] | lower }}.yml" tags: - always - name: Detect mirrors file ansible.builtin.stat: path: "{{ test_deps_mirrors_file_path }}" register: mirrors_file - name: RHEL Block become: true when: - (ansible_facts['os_family'] | lower) == 'redhat' - mirrors_file.stat.exists | bool block: - name: Disable ubi host subscription-manager integration ansible.builtin.file: path: /etc/rhsm-host state: absent - name: Disable ubi 9 repos when: - ansible_facts['distribution_major_version'] is version(9, '>=') ansible.builtin.yum_repository: name: "{{ item }}" state: absent keepcache: false reposdir: /etc/yum.repos.d with_items: - ubi-9-appstream - ubi-9-baseos - ubi-9-codeready-builder - name: Deploy repo-setup vars: cifmw_repo_setup_output: "/etc/yum.repos.d" cifmw_repo_setup_branch: "master" cifmw_repo_setup_promotion: "current-podified" cifmw_repo_setup_os_release: "centos" cifmw_repo_setup_additional_repos: "{{ test_deps_setup_ceph | ternary('ceph', '', omit) }}" ansible.builtin.include_role: name: "repo_setup" - name: Tripleo setup block become: true when: - (ansible_facts['os_family'] | lower) == 'redhat' - test_deps_setup_cifmw | bool block: - name: Look for redhat-release rpm ansible.builtin.command: cmd: "rpm -qe redhat-release" # noqa: command-instead-of-module register: rpm_found ignore_errors: true - name: Workaround of redhat-release binary on ubi9 when: - rpm_found.rc == 0 block: - name: Remove redhat-release ansible.builtin.command: cmd: "rpm -e --nodeps redhat-release" # noqa: command-instead-of-module - name: Install centos-stream-release tags: - bootstrap - packages ansible.builtin.package: name: "centos-stream-release" state: latest # noqa: package-latest releasever: "{{ ansible_facts['distribution_major_version'] }}" - name: Install additional packages tags: - bootstrap - packages ansible.builtin.package: name: "{{ test_deps_cifmw_packages }}" state: present releasever: "{{ ansible_facts['distribution_major_version'] }}" - name: Package block become: true block: - name: Install selinux python libs tags: - bootstrap - packages ansible.builtin.package: name: "{{ test_deps_selinux_packages }}" state: present releasever: "{{ ansible_facts['distribution_major_version'] }}" when: - (ansible_facts['os_family'] | lower) == 'redhat' - name: Install python yaml libs tags: - bootstrap - packages ansible.builtin.package: name: "{{ test_deps_yaml_packages }}" state: present releasever: "{{ ansible_facts['distribution_major_version'] }}" when: - (ansible_facts['os_family'] | lower) == 'redhat' - name: Install extra packages tags: - bootstrap - packages ansible.builtin.package: name: "{{ test_deps_extra_packages }}" state: present releasever: "{{ ansible_facts['distribution_major_version'] }}" when: - (test_deps_extra_packages | length) > 0