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:
230230 run : |
231231 source venvs/kayobe/bin/activate &&
232232 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
234235 env :
235236 KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
236237
Original file line number Diff line number Diff line change @@ -291,7 +291,8 @@ jobs:
291291 -v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
292292 -e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
293293 ${{ 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
295296 env :
296297 KAYOBE_AUTOMATION_SSH_PRIVATE_KEY : ${{ steps.ssh_key.outputs.ssh_key }}
297298
Original file line number Diff line number Diff line change 2727 vars :
2828 reboot_hosts : fix-hostname
2929 reboot_with_bootstrap_user : true
30+ confirm_reboot : " yes"
3031 when : current_hostname.stdout != inventory_hostname
Original file line number Diff line number Diff line change 99 ansible_user : " {{ bootstrap_user if reboot_with_bootstrap_user | bool else kayobe_ansible_user }}"
1010 ansible_ssh_common_args : " {{ '-o StrictHostKeyChecking=no' if reboot_with_bootstrap_user | bool else '' }}"
1111 ansible_python_interpreter : /usr/bin/python3
12+ confirm_reboot : False
1213 tags :
1314 - reboot
1415 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+
1532 - name : Reboot and wait
1633 become : true
1734 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