updates to logic flow
This commit is contained in:
parent
991a810ac0
commit
5b24f605b6
@ -14,4 +14,9 @@ verified_reboot_wait_sleep: 10
|
|||||||
verified_reboot_wait_delay: 70
|
verified_reboot_wait_delay: 70
|
||||||
|
|
||||||
# Maximum number of seconds to wait for.
|
# Maximum number of seconds to wait for.
|
||||||
|
#
|
||||||
|
# We need to ensure this is long enough to cover ANY reboot
|
||||||
|
# from either Bigboot or IPU based reboots using this
|
||||||
|
#
|
||||||
|
# Default: 1800 (30mins)
|
||||||
verified_reboot_wait_timeout: 1800
|
verified_reboot_wait_timeout: 1800
|
||||||
|
@ -1,38 +1,47 @@
|
|||||||
---
|
---
|
||||||
|
- name: Max check count reached
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "Max check count ({{ max_reboot_check }}) reached. Aborting after {{ reboot_check_count }} tries."
|
||||||
|
when:
|
||||||
|
- reboot_check_count | int >= max_reboot_check
|
||||||
|
|
||||||
|
- name: Increment check count
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
reboot_check_count: "{{ reboot_check_count | int + 1 }}"
|
||||||
|
|
||||||
|
- name: Current Iteration
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ reboot_check_count }}"
|
||||||
|
verbosity: 1
|
||||||
|
|
||||||
|
- name: Wait for host to connect or try again
|
||||||
|
block:
|
||||||
- name: Wait for connection to host
|
- name: Wait for connection to host
|
||||||
ansible.builtin.wait_for_connection:
|
ansible.builtin.wait_for_connection:
|
||||||
connect_timeout: "{{ verified_reboot_wait_conn_timeout }}"
|
connect_timeout: "{{ verified_reboot_wait_conn_timeout }}"
|
||||||
sleep: "{{ verified_reboot_wait_sleep }}"
|
sleep: "{{ verified_reboot_wait_sleep }}"
|
||||||
delay: "{{ verified_reboot_wait_delay }}"
|
delay: "{{ verified_reboot_wait_delay }}"
|
||||||
timeout: "{{ verified_reboot_wait_timeout }}"
|
timeout: "{{ verified_reboot_wait_timeout }}"
|
||||||
|
rescue:
|
||||||
|
- name: Re-check host status - RESCUE
|
||||||
|
ansible.builtin.include_tasks: check_boot_id.yml
|
||||||
|
|
||||||
- name: Increment check count
|
- name: Capture boot ID post reboot
|
||||||
ansible.builtin.set_fact:
|
|
||||||
verified_reboot_check_count:
|
|
||||||
"{{ 1 if verified_reboot_check_count is undefined else verified_reboot_check_count | int + 1 }}"
|
|
||||||
|
|
||||||
- name: Capture post-reboot boot ID
|
|
||||||
ansible.builtin.slurp:
|
ansible.builtin.slurp:
|
||||||
src: "{{ verified_reboot_bootid_file }}"
|
src: "{{ bootid_file }}"
|
||||||
register: verified_reboot_post_boot_id_raw
|
register: post_reboot_boot_id_raw
|
||||||
|
|
||||||
- name: Set post-reboot boot ID
|
- name: Set post-reboot boot ID
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
verified_reboot_post_boot_id: "{{ verified_reboot_post_boot_id_raw['content'] | b64decode | trim }}"
|
post_reboot_boot_id: "{{ post_reboot_boot_id_raw['content'] | b64decode | trim }}"
|
||||||
|
|
||||||
- name: Debug boot IDs
|
- name: Debug boot IDs
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ verified_reboot_pre_boot_id }} == {{ verified_reboot_post_boot_id }}"
|
msg: "{{ pre_reboot_boot_id }} == {{ post_reboot_boot_id }}"
|
||||||
verbosity: 1
|
verbosity: 1
|
||||||
|
|
||||||
- name: Max check count exception
|
- name: Re-check host status
|
||||||
ansible.builtin.fail:
|
|
||||||
msg: "Max check count ({{ verified_reboot_max_checks }}) reached. Aborting."
|
|
||||||
when:
|
|
||||||
- verified_reboot_check_count | int >= verified_reboot_max_checks
|
|
||||||
|
|
||||||
- name: Re-check host reboot status
|
|
||||||
ansible.builtin.include_tasks: check_boot_id.yml
|
ansible.builtin.include_tasks: check_boot_id.yml
|
||||||
when:
|
when:
|
||||||
- verified_reboot_pre_boot_id == verified_reboot_post_boot_id
|
- pre_reboot_boot_id == post_reboot_boot_id
|
||||||
- verified_reboot_check_count | int < verified_reboot_max_checks
|
- reboot_check_count | int < max_reboot_check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user