File tree Expand file tree Collapse file tree 5 files changed +33
-2
lines changed Expand file tree Collapse file tree 5 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,8 @@ jobs:
230
230
run : |
231
231
source venvs/kayobe/bin/activate &&
232
232
source src/kayobe-config/kayobe-env --environment ci-doca-builder &&
233
- kayobe playbook run src/kayobe-config/etc/kayobe/ansible/reboot.yml
233
+ kayobe playbook run src/kayobe-config/etc/kayobe/ansible/reboot.yml \
234
+ -e confirm_reboot=yes
234
235
env :
235
236
KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
236
237
Original file line number Diff line number Diff line change @@ -291,7 +291,8 @@ jobs:
291
291
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
292
292
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
293
293
${{ steps.kayobe_image.outputs.kayobe_image }} \
294
- /stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh etc/kayobe/ansible/reboot.yml -e reboot_with_bootstrap_user=true
294
+ /stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh etc/kayobe/ansible/reboot.yml \
295
+ -e reboot_with_bootstrap_user=true -e confirm_reboot=yes
295
296
env :
296
297
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY : ${{ steps.ssh_key.outputs.ssh_key }}
297
298
Original file line number Diff line number Diff line change 27
27
vars :
28
28
reboot_hosts : fix-hostname
29
29
reboot_with_bootstrap_user : true
30
+ confirm_reboot : " yes"
30
31
when : current_hostname.stdout != inventory_hostname
Original file line number Diff line number Diff line change 9
9
ansible_user : " {{ bootstrap_user if reboot_with_bootstrap_user | bool else kayobe_ansible_user }}"
10
10
ansible_ssh_common_args : " {{ '-o StrictHostKeyChecking=no' if reboot_with_bootstrap_user | bool else '' }}"
11
11
ansible_python_interpreter : /usr/bin/python3
12
+ confirm_reboot : False
12
13
tags :
13
14
- reboot
14
15
tasks :
16
+ - name : Prompt to confirm reboot
17
+ ansible.builtin.pause :
18
+ prompt : >
19
+ The following hosts will be rebooted:
20
+ {{ play_hosts | join(', ') }}
21
+ If you want to proceed type: yes
22
+ register : pause_prompt
23
+ when : not confirm_reboot
24
+
25
+ - name : Fail if reboot is not confirmed
26
+ ansible.builtin.assert :
27
+ that : confirm_reboot == 'yes' or pause_prompt.user_input == 'yes'
28
+ msg : >
29
+ Reboot has not been confirmed. You must either type 'yes' when
30
+ prompted, or set ``confirm_reboot=yes``.
31
+
15
32
- name : Reboot and wait
16
33
become : true
17
34
ansible.builtin.reboot :
Original file line number Diff line number Diff line change
1
+ ---
2
+ features :
3
+ - |
4
+ A confirmation prompt has been added to ``reboot.yml`` to help avoid
5
+ rebooting the wrong hosts by mistake. This check can be skipped by setting
6
+ ``confirm_reboot=yes``.
7
+ upgrade :
8
+ - |
9
+ A confirmation prompt has been added to ``reboot.yml`` to help avoid
10
+ rebooting the wrong hosts by mistake. This check can be skipped by setting
11
+ ``confirm_reboot=yes``.
You can’t perform that action at this time.
0 commit comments