This commit is contained in:
2025-10-22 21:35:07 +03:00
parent 5743943ce5
commit e1653cf1b2
2 changed files with 109 additions and 82 deletions

View File

@@ -59,6 +59,17 @@
register: dev1_host_read
changed_when: false
- name: Debug incoming parameters from consumer and defaults
delegate_to: localhost
ansible.builtin.debug:
msg:
- "rebootin={{ rebootin | default('UNSET') }}"
- "image_filename={{ image_filename | default('UNSET') }}"
- "image_md5={{ image_md5 | default('UNSET') }}"
- "image_sha256={{ image_sha256 | default('UNSET') }}"
- "afterupgrade_routing_key={{ afterupgrade_routing_key | default('UNSET') }}"
- "inventory_hostname={{ inventory_hostname }}"
- name: Stop early if connected DEV1 hostname != inventory
ansible.builtin.meta: end_host
when: (dev1_host_read.stdout | trim | length > 0) and
@@ -484,6 +495,22 @@
else (rebootin | int if ((rebootin | default('') | string | trim) is match('^\\d+$')) else -1)
}}
- name: Debug reboot normalization detail
delegate_to: localhost
ansible.builtin.debug:
msg:
- "_reboot_raw={{ _reboot_raw | default('UNSET') }}"
- "_reboot_is_now={{ _reboot_is_now | default('UNSET') }}"
- "_reboot_is_int={{ _reboot_is_int | default('UNSET') }}"
- "_reboot_hours={{ _reboot_hours | default('UNSET') }}"
- name: Warn if rebootin was not provided by consumer (debug only)
when: (rebootin | default('') | string | trim) == ''
delegate_to: localhost
ansible.builtin.debug:
msg: "WARNING: rebootin is empty or missing. Consumer likely did not pass -e rebootin=<hours>."
# 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