Ask for confirmation during overcloud deprovision

Prompts the user to confirm before deprovisioning any overcloud hosts.
The user is given a list of hosts which will be deprovisioned. Automatic
confirmation can be achieved by setting ``confirm_deprovison`` to
``yes``.

Change-Id: I6eea5bb7c268912e6f39627f64c92715877311a3
This commit is contained in:
Matt Crees 2023-12-14 11:00:14 +00:00
parent bb2af07567
commit 74f1bf7eff
3 changed files with 29 additions and 1 deletions

View File

@ -29,8 +29,23 @@
ironic_retries: 6 ironic_retries: 6
ironic_retry_interval: 5 ironic_retry_interval: 5
seed_host: "{{ groups['seed'][0] }}" seed_host: "{{ groups['seed'][0] }}"
vars_prompt:
- name: confirm_deprovision
prompt: |
The following hosts will be deprovisioned:
{{ play_hosts | join(', ') }}
If you want to proceed type: yes
default: "no"
private: false
gather_facts: no gather_facts: no
tasks: tasks:
- name: Fail if deprovision is not confirmed
assert:
that: confirm_deprovision == 'yes'
msg: >
Deprovision has not been confirmed. You must either type 'yes' when
prompted, or set ``confirm_deprovision=yes``.
- name: Check the ironic node's initial provision state - name: Check the ironic node's initial provision state
command: > command: >
docker exec bifrost_deploy docker exec bifrost_deploy

View File

@ -181,7 +181,9 @@ Deprovisioning The Cloud
.. note:: .. note::
This step will power down the overcloud hosts and delete their nodes' This step will power down the overcloud hosts and delete their nodes'
instance state from the seed's ironic service. instance state from the seed's ironic service. This command will print a
list of hosts which will be deprovisioned, you must type ``yes`` to confirm.
To automatically confirm, pass the variable ``-e confirm_deprovision=yes``.
To deprovision the overcloud:: To deprovision the overcloud::

View File

@ -0,0 +1,11 @@
---
features:
- |
``kayobe overcloud deprovision`` now requires confirmation before any hosts
are deprovisioned. Automatic confirmation can still be achieved by setting
``confirm_deprovision`` to ``yes``.
upgrade:
- |
``kayobe overcloud deprovision`` now requires confirmation before any hosts
are deprovisioned. Automatic confirmation can still be achieved by setting
``confirm_deprovision`` to ``yes``.