1743
This commit is contained in:
@@ -471,7 +471,8 @@
|
|||||||
msg: "DEV2 firmux={{ (dev2_firmux.stdout | default('')) | trim }}"
|
msg: "DEV2 firmux={{ (dev2_firmux.stdout | default('')) | trim }}"
|
||||||
|
|
||||||
# ---------------------------- Normalize rebootin early (HOURS) ----------------------------
|
# ---------------------------- Normalize rebootin early (HOURS) ----------------------------
|
||||||
- name: Normalize 'rebootin' (detect 'now' or integer HOURS)
|
# Normalize 'rebootin' (detect 'now' or integer HOURS)
|
||||||
|
- name: Normalize rebootin detect now or integer HOURS
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
_reboot_raw: "{{ rebootin | default('') | string | trim | lower }}"
|
_reboot_raw: "{{ rebootin | default('') | string | trim | lower }}"
|
||||||
@@ -480,23 +481,24 @@
|
|||||||
_reboot_hours: >-
|
_reboot_hours: >-
|
||||||
{{
|
{{
|
||||||
0 if ((rebootin | default('') | string | trim | lower) in ['', 'now', 'immediate'])
|
0 if ((rebootin | default('') | string | trim | lower) in ['', 'now', 'immediate'])
|
||||||
else (rebootin | int if ((rebootin | default('') | string | trim) is match('^\\d+$') ) else -1)
|
else (rebootin | int if ((rebootin | default('') | string | trim) is match('^\\d+$')) else -1)
|
||||||
}}
|
}}
|
||||||
|
|
||||||
- name: Compute reboot flags requested and seconds
|
# Compute reboot flags and *final* seconds value with the 20s grace rule
|
||||||
|
# Rule: now/empty -> 20s; integer <=0 -> 20s; integer >0 -> hours*3600
|
||||||
|
- name: Compute reboot flags requested and seconds with 20s grace
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
_reboot_requested: "{{ _reboot_is_now or _reboot_is_int }}"
|
_reboot_requested: "{{ _reboot_is_now or _reboot_is_int }}"
|
||||||
_reboot_seconds: >-
|
_reboot_seconds: >-
|
||||||
{{
|
{{
|
||||||
20
|
20
|
||||||
if (_reboot_requested | default(false)) and ((_reboot_hours | int) <= 0)
|
if _reboot_is_now
|
||||||
else
|
else (20 if ((_reboot_is_int | bool) and ((_reboot_hours | int) <= 0))
|
||||||
(((_reboot_hours | int) * 3600))
|
else ((_reboot_hours | int) * 3600))
|
||||||
if (_reboot_requested | default(false))
|
|
||||||
else 0
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
# Derive minutes from seconds
|
||||||
- name: Derive reboot minutes from seconds
|
- name: Derive reboot minutes from seconds
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
@@ -521,7 +523,7 @@
|
|||||||
Indoor: Dev2 is reachable, starting update.
|
Indoor: Dev2 is reachable, starting update.
|
||||||
image={{ image_filename }}, md5={{ image_md5 }},
|
image={{ image_filename }}, md5={{ image_md5 }},
|
||||||
firmux={{ (dev2_firmux.stdout | default('unknown')) | trim }},
|
firmux={{ (dev2_firmux.stdout | default('unknown')) | trim }},
|
||||||
reboot={{ 'in ' ~ (_reboot_seconds | int) ~ ' seconds' if (_reboot_is_now and (_reboot_minutes | int) == 0) else (rebootin | default('') | trim) }}
|
reboot={{ 'in ' ~ (_reboot_seconds | int) ~ ' seconds' if (_reboot_requested | default(false)) else 'not requested' }}
|
||||||
when: dev2_passfile_used != "NONE"
|
when: dev2_passfile_used != "NONE"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
@@ -1097,8 +1099,8 @@
|
|||||||
- "active_before={{ (dev2_active_before.stdout | default('NA')) | trim }}"
|
- "active_before={{ (dev2_active_before.stdout | default('NA')) | trim }}"
|
||||||
- "active_after={{ (dev2_active_after.stdout | default('NA')) | trim }}"
|
- "active_after={{ (dev2_active_after.stdout | default('NA')) | trim }}"
|
||||||
- "reboot_requested={{ _reboot_requested | default(false) }}"
|
- "reboot_requested={{ _reboot_requested | default(false) }}"
|
||||||
- "reboot_delay_minutes={{ (_reboot_minutes | int) if (_reboot_requested | default(false)) else 'NA' }}"
|
- "reboot_delay_seconds={{ _reboot_seconds | int if (_reboot_requested | default(false)) else 'NA' }}"
|
||||||
- "reboot_delay_seconds={{ (_reboot_seconds | int) if (_reboot_requested | default(false)) else 'NA' }}"
|
- "reboot_delay_minutes={{ _reboot_minutes | int if (_reboot_requested | default(false)) else 'NA' }}"
|
||||||
- "reboot_applied={{ (dev2_reboot_sched is defined and dev2_reboot_sched.rc is defined and dev2_reboot_sched.rc == 0) | default(false) }}"
|
- "reboot_applied={{ (dev2_reboot_sched is defined and dev2_reboot_sched.rc is defined and dev2_reboot_sched.rc == 0) | default(false) }}"
|
||||||
- "prep_blocked={{ _prep_blocked | default(false) }}"
|
- "prep_blocked={{ _prep_blocked | default(false) }}"
|
||||||
- "blocked={{ _blocked | default(false) }}"
|
- "blocked={{ _blocked | default(false) }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user