40a1c7669a
Nova will soon be switched off on the undercloud, so baremetal playbooks cannot assume that nova is used. This change only runs cell discovery when there is a nova endpoint in the catalog. Change-Id: I97d9412c57da23f8783d2eaa4b56dea7edf11746 Blueprint: nova-less-deploy
101 lines
3.2 KiB
YAML
101 lines
3.2 KiB
YAML
---
|
|
# Copyright 2019 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: Overcloud Node Provide
|
|
connection: "{{ (tripleo_target_host is defined) | ternary('ssh', 'local') }}"
|
|
hosts: "{{ tripleo_target_host | default('localhost') }}"
|
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
|
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- name: Check for required inputs
|
|
fail:
|
|
msg: >
|
|
Input missing `{{ item }}`
|
|
when:
|
|
- hostvars[inventory_hostname][item] is undefined
|
|
loop:
|
|
- node_uuids
|
|
tasks:
|
|
- name: Set node_uuids_provide fact
|
|
set_fact:
|
|
node_uuids_provide: "{{ node_uuids }}"
|
|
|
|
- name: exit if nothing to do
|
|
block:
|
|
- name: Notice
|
|
debug:
|
|
msg: No nodes are manageable at this time.
|
|
|
|
- name: end play
|
|
meta: end_play
|
|
when:
|
|
- node_uuids_provide == []
|
|
|
|
# Set nodes to available
|
|
- name: Make nodes available
|
|
os_baremetal_provide_node:
|
|
cloud: undercloud
|
|
node_uuid: "{{ node_uuids_provide }}"
|
|
timeout: 1200
|
|
wait_for_bridge_mappings: true
|
|
|
|
- name: Nova cell host discovery
|
|
block:
|
|
- name: Detect nova service endpoint
|
|
command: >-
|
|
openstack --os-cloud undercloud catalog show nova
|
|
register: nova_catalog_show
|
|
failed_when: "'service nova not found' in nova_catalog_show.stderr"
|
|
|
|
# Run cellv2 discovery of hosts
|
|
- name: Run cell_v2 host discovery
|
|
command: podman exec nova_api /bin/nova-manage cell_v2 discover_hosts --verbose
|
|
changed_when: false
|
|
become: true
|
|
|
|
- name: Wait for nova resources
|
|
command: >-
|
|
openstack --os-cloud undercloud hypervisor show {{ item }}
|
|
loop: "{{ node_uuids_provide }}"
|
|
changed_when: false
|
|
register: hypervisor_check
|
|
until: hypervisor_check is success
|
|
delay: 30
|
|
retries: 30
|
|
rescue:
|
|
- debug:
|
|
msg: 'Nova endpoint not found, skipping cell host discovery'
|
|
|
|
# Power off nodes the nodes
|
|
- name: Power off nodes
|
|
command: >-
|
|
openstack --os-cloud undercloud baremetal node power off {{ item }}
|
|
loop: "{{ node_uuids_provide }}"
|
|
async: 2400
|
|
poll: 0
|
|
register: node_power_off
|
|
|
|
- name: poll for completion
|
|
async_status:
|
|
jid: "{{ item.ansible_job_id }}"
|
|
loop: "{{ node_power_off.results }}"
|
|
loop_control:
|
|
label: "{{ item.item }}"
|
|
register: wait
|
|
until: wait.finished
|
|
retries: 120
|