Make bootstrap tasks more modular
To avoid calling the same tasks multiple times, this change splits out the packages component. This allows us to call it from other tasks without running the entire role Change-Id: Ifc38772898e864af9c76d45e87b34e4390bfd033
This commit is contained in:
parent
ba4e9908ac
commit
2dcc356a31
|
@ -52,29 +52,8 @@
|
|||
when:
|
||||
- rpm_query_result.rc > 0
|
||||
|
||||
- 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: Include packages tasks
|
||||
include_tasks: packages.yml
|
||||
|
||||
- name: Create /var/lib/heat-config/tripleo-config-download directory for deployment data
|
||||
become: true
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
# 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 if they don't exist
|
||||
setup:
|
||||
gather_subset: min
|
||||
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
|
Loading…
Reference in New Issue