Skip to content

Commit 0205896

Browse files
committed
Use pause module to prompt for deprovision
This is the workaround to the issue recommended here: ansible/ansible#84515 (comment) Now that confirm_deprovision is a proper variable, we also support setting it to any boolean. Change-Id: Ief8074cb54451464d827f9a35f4cfdd80cf2f0d7
1 parent 53ece53 commit 0205896

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

ansible/overcloud-deprovision.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@
3333
ironic_retries: 6
3434
ironic_retry_interval: 5
3535
seed_host: "{{ groups['seed'][0] }}"
36-
vars_prompt:
37-
- name: confirm_deprovision
38-
prompt: |
39-
The following hosts will be deprovisioned:
40-
{{ play_hosts | intersect(groups['overcloud'] | default([])) | join(', ') }}
41-
If you want to proceed type: yes
42-
default: "no"
43-
private: false
36+
confirm_deprovision: False
4437
gather_facts: no
4538
tasks:
39+
- name: Prompt to confirm deprovision
40+
ansible.builtin.pause:
41+
prompt: >
42+
The following hosts will be deprovisioned:
43+
{{ play_hosts | join(', ') }}
44+
If you want to proceed type: yes
45+
register: pause_prompt
46+
when: not confirm_deprovision
47+
4648
- name: Fail if deprovision is not confirmed
4749
assert:
48-
that: confirm_deprovision == 'yes'
50+
that: confirm_deprovision | bool or pause_prompt.user_input == 'yes'
4951
msg: >
5052
Deprovision has not been confirmed. You must either type 'yes' when
5153
prompted, or set ``confirm_deprovision=yes``.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Updates ``overcloud-deprovision.yml`` to use ``ansible.builtin.pause`` when
5+
prompting to confirm deprovisioning. This is the recommended workaround to
6+
`Ansible issue 84515 <https://github.com/ansible/ansible/issues/84515>`__.

0 commit comments

Comments
 (0)