From 74f1bf7eff39ac50cc4d122b793b4c2a9718f487 Mon Sep 17 00:00:00 2001 From: Matt Crees Date: Thu, 14 Dec 2023 11:00:14 +0000 Subject: [PATCH] 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 --- ansible/overcloud-deprovision.yml | 15 +++++++++++++++ doc/source/administration/overcloud.rst | 4 +++- ...re-overcloud-deprovision-6976c8b3c043bc99.yaml | 11 +++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/confirm-before-overcloud-deprovision-6976c8b3c043bc99.yaml diff --git a/ansible/overcloud-deprovision.yml b/ansible/overcloud-deprovision.yml index 76bd34459..824f8ccbb 100644 --- a/ansible/overcloud-deprovision.yml +++ b/ansible/overcloud-deprovision.yml @@ -29,8 +29,23 @@ ironic_retries: 6 ironic_retry_interval: 5 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 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 command: > docker exec bifrost_deploy diff --git a/doc/source/administration/overcloud.rst b/doc/source/administration/overcloud.rst index 38065923b..e576a810b 100644 --- a/doc/source/administration/overcloud.rst +++ b/doc/source/administration/overcloud.rst @@ -181,7 +181,9 @@ Deprovisioning The Cloud .. note:: 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:: diff --git a/releasenotes/notes/confirm-before-overcloud-deprovision-6976c8b3c043bc99.yaml b/releasenotes/notes/confirm-before-overcloud-deprovision-6976c8b3c043bc99.yaml new file mode 100644 index 000000000..12d93e147 --- /dev/null +++ b/releasenotes/notes/confirm-before-overcloud-deprovision-6976c8b3c043bc99.yaml @@ -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``.