Skip to content

Commit

Permalink
playbooks: ensure booting has been finished
Browse files Browse the repository at this point in the history
When rebooting ensure systemd has finished to boot the systemd before
running Ansible.

Signed-off-by: Mathieu Dupré <[email protected]>
  • Loading branch information
dupremathieu authored and insatomcat committed Nov 16, 2022
1 parent d147c19 commit 4f63b8d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
5 changes: 1 addition & 4 deletions playbooks/ci_set_efi_boot_entries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@
changed_when: result.rc == 2
failed_when: result.rc == 1
- name: Reboot on default slot
reboot:
when: result.rc == 2
- name: Wait for host to be online
wait_for_connection:
include_tasks: tasks/soft_restart_machine.yaml
when: result.rc == 2
8 changes: 1 addition & 7 deletions playbooks/cluster_setup_kernel_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@
regexp: '(root=.*)'
replace: '\1 {{ extra_kernel_parameters }}'
when: extra_param_needed is defined
- name: Restart
reboot:
when:
- kernel_parameters_restart is defined
- kernel_parameters_restart
- name: Wait for host to be online
wait_for_connection:
- include_tasks: tasks/soft_restart_machine.yaml
when:
- kernel_parameters_restart is defined
- kernel_parameters_restart
Expand Down
6 changes: 1 addition & 5 deletions playbooks/cluster_setup_network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,5 @@
- name: Restart machine if needed
hosts: cluster_machines
tasks:
- block:
- name: Restart
reboot:
- name: Wait for host to be online
wait_for_connection:
- include_tasks: tasks/soft_restart_machine.yaml
when: need_reboot is defined and need_reboot
12 changes: 12 additions & 0 deletions playbooks/tasks/soft_restart_machine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (C) 2022, RTE (http://www.rte-france.com)
# SPDX-License-Identifier: Apache-2.0
---

- name: Restart
reboot:
- name: Wait for host to be online
wait_for_connection:
- name: Wait systemd has finished to boot
command: systemctl is-system-running --wait
register: system_status
failed_when: system_status.rc != 0 and system_status.rc != 1

0 comments on commit 4f63b8d

Please sign in to comment.