ddde8e573e
This reverts commit 476d0e3bef
.
It looks like this change is masking the root cause of bug #1879472, it
is probably not appropriate to do a retry on a whole
metalsmith_instances call, it would be better to do retries on
individual API calls and handle failures of instance provisioning on
an instance-by-instance basis inside the module.
Change-Id: If6814de77c110b622bd4e5b6430d65fce7dd19ff
Related-Bug: #1879472
82 lines
2.9 KiB
YAML
82 lines
2.9 KiB
YAML
---
|
|
# Copyright 2020 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 Unprovision
|
|
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
|
|
vars:
|
|
prompt: true
|
|
all: false
|
|
pre_tasks:
|
|
- fail:
|
|
msg: stack_name is a required input
|
|
when:
|
|
- stack_name is undefined
|
|
- fail:
|
|
msg: baremetal_deployment is a required input
|
|
when:
|
|
- baremetal_deployment is undefined
|
|
- fail:
|
|
msg: unprovision_confirm or unprovision_environment is required when prompt is true
|
|
when:
|
|
- prompt
|
|
- unprovision_confirm is undefined
|
|
- unprovision_environment is undefined
|
|
|
|
tasks:
|
|
|
|
- name: Expand roles
|
|
tripleo_baremetal_expand_roles:
|
|
baremetal_deployment: "{{ baremetal_deployment }}"
|
|
stack_name: "{{ stack_name }}"
|
|
state: "{{ all|bool and 'all' or 'absent' }}"
|
|
register: baremetal_instances
|
|
|
|
- name: Find existing instances
|
|
tripleo_baremetal_check_existing:
|
|
instances: "{{ baremetal_instances.instances }}"
|
|
register: baremetal_existing
|
|
|
|
- name: Write unprovision confirmation
|
|
block:
|
|
- name: Write instances for confirmation
|
|
copy:
|
|
dest: "{{ unprovision_confirm }}"
|
|
content: "{{ baremetal_existing.instances | to_json }}"
|
|
when: unprovision_confirm is defined
|
|
- name: Expand roles for provisioned instances
|
|
tripleo_baremetal_expand_roles:
|
|
baremetal_deployment: "{{ baremetal_deployment }}"
|
|
stack_name: "{{ stack_name }}"
|
|
state: present
|
|
register: baremetal_instances_existing
|
|
when: unprovision_environment is defined
|
|
- name: Write environment for node delete resource mapping
|
|
copy:
|
|
dest: "{{ unprovision_environment }}"
|
|
content: "{{ baremetal_instances_existing.environment | to_json }}"
|
|
when: unprovision_environment is defined
|
|
when: prompt|bool
|
|
|
|
- name: Unprovision instances
|
|
metalsmith_instances:
|
|
instances: "{{ baremetal_existing.instances }}"
|
|
state: absent
|
|
when: not prompt|bool
|