68 lines
2.8 KiB
YAML
68 lines
2.8 KiB
YAML
---
|
|
# Copyright 2022 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 and variables if they don't exist
|
|
block:
|
|
- name: Gather facts if they don't exist
|
|
setup:
|
|
gather_subset: min
|
|
|
|
# found within the "vars/" path. If no OS files are found the task will skip.
|
|
- name: Gather variables for each operating system
|
|
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
|
|
when: not ansible_distribution|default(false)
|
|
|
|
- name: Check required packages to bootstrap TripleO is installed
|
|
command: "rpm -q --whatprovides {{ tripleo_bootstrap_packages_bootstrap | join(' ') }}"
|
|
args:
|
|
warn: false
|
|
register: rpm_query_result
|
|
failed_when: false
|
|
|
|
- name: Deploy required packages to bootstrap TripleO
|
|
become: true
|
|
package:
|
|
name: "{{ tripleo_bootstrap_packages_bootstrap }}"
|
|
state: present
|
|
# When a node is deployed with overcloud-minimal, OVS isn't required so let's
|
|
# ignore the case where the package can't be found (e.g. missing subscription).
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1820306
|
|
failed_when:
|
|
- (ansible_facts['distribution'] | lower) == 'redhat'
|
|
- not ansible_check_mode|bool
|
|
- (tripleo_bootstrap_packages_bootstrap_result.rc | int) == 1
|
|
- not ('No package openvswitch available.' in tripleo_bootstrap_packages_bootstrap_result.failures | default([]))
|
|
register: tripleo_bootstrap_packages_bootstrap_result
|
|
when:
|
|
- rpm_query_result.rc > 0
|
|
|
|
- name: Ensure packages are actually well installed
|
|
command: "rpm -V {{ tripleo_bootstrap_packages_bootstrap | join(' ') }}"
|
|
register: rpm_verify_result
|
|
failed_when:
|
|
- "'%verify' in rpm_verify_result.stderr"
|