Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions etc/kayobe/ansible/reboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,26 @@
ansible_user: "{{ bootstrap_user if reboot_with_bootstrap_user | bool else kayobe_ansible_user }}"
ansible_ssh_common_args: "{{ '-o StrictHostKeyChecking=no' if reboot_with_bootstrap_user | bool else '' }}"
ansible_python_interpreter: /usr/bin/python3
confirm_reboot: false
tags:
- reboot
tasks:
- name: Prompt to confirm reboot
ansible.builtin.pause:
prompt: >
The following hosts will be rebooted:
{{ play_hosts | join(', ') }}
If you want to proceed type: yes
register: pause_prompt
when: not confirm_reboot

- name: Fail if reboot is not confirmed
ansible.builtin.assert:
that: confirm_reboot | bool or pause_prompt.user_input == 'yes'
msg: >
Reboot has not been confirmed. You must either type 'yes' when
prompted, or set ``confirm_reboot: true``.

- name: Reboot and wait
become: true
ansible.builtin.reboot:
Expand Down
6 changes: 6 additions & 0 deletions etc/kayobe/environments/aufn-ceph/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ os_distribution: "{{ lookup('pipe', '. /etc/os-release && echo $ID') | trim }}"
os_release: >-
{{ (lookup('pipe', '. /etc/os-release && echo $VERSION_CODENAME') | trim) if os_distribution == 'ubuntu' else
(lookup('pipe', '. /etc/os-release && echo $VERSION_ID') | trim | split('.') | first) if os_distribution == 'rocky' }}

###############################################################################
# Extra vars.

# Don't prompt when rebooting hosts.
confirm_reboot: true
6 changes: 6 additions & 0 deletions etc/kayobe/environments/ci-aio/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ os_release: >-
{{ (lookup('pipe', '. /etc/os-release && echo $VERSION_CODENAME') | trim) if os_distribution == 'ubuntu' else
(lookup('pipe', '. /etc/os-release && echo $VERSION_ID') | trim | split('.') | first) if os_distribution == 'rocky' }}

###############################################################################
# Extra vars.

# Don't prompt when rebooting hosts.
confirm_reboot: true

###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
6 changes: 6 additions & 0 deletions etc/kayobe/environments/ci-builder/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
# OS distribution name. Valid options are "rocky", "ubuntu". Default is
# "rocky".
os_distribution: "{{ lookup('pipe', '. /etc/os-release && echo $ID') | trim }}"

###############################################################################
# Extra vars.

# Don't prompt when rebooting hosts.
confirm_reboot: true
6 changes: 6 additions & 0 deletions etc/kayobe/environments/ci-doca-builder/globals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
###############################################################################
# Extra vars.

# Don't prompt when rebooting hosts.
confirm_reboot: true
6 changes: 6 additions & 0 deletions etc/kayobe/environments/ci-multinode/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ stackhpc_barbican_role_id_file_path: "/tmp/barbican-role-id"
# Enable rebooting to update SELinux state
selinux_do_reboot: true

###############################################################################
# Extra vars.

# Don't prompt when rebooting hosts.
confirm_reboot: true

###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
A confirmation prompt has been added to ``reboot.yml`` to help avoid
rebooting the wrong hosts by mistake. This check can be skipped by setting
``confirm_reboot: true``.
Loading