From 5e4554b6533211501a87b7cfcbc86630c8cb816c Mon Sep 17 00:00:00 2001 From: pavel Date: Wed, 1 Apr 2026 10:16:00 +0300 Subject: [PATCH] 1016 --- .../update-indoorbackup223r6828.yml | 71 ++++--------------- 1 file changed, 12 insertions(+), 59 deletions(-) diff --git a/files/ansible-playbooks/update-indoorbackup223r6828.yml b/files/ansible-playbooks/update-indoorbackup223r6828.yml index c3df875..1f2f58f 100644 --- a/files/ansible-playbooks/update-indoorbackup223r6828.yml +++ b/files/ansible-playbooks/update-indoorbackup223r6828.yml @@ -91,11 +91,6 @@ ansible.builtin.set_fact: force_upgrade_raw: "{{ (vars['force-upgrade'] if ('force-upgrade' in vars) else (force_upgrade | default(''))) | string | trim }}" - # >>> TEMPORARY OVERRIDE (REMOVE THIS TASK LATER) <<< - - name: TEMPORARILY set force-upgrade to yes (REMOVE BEFORE COMMITTING) - ansible.builtin.set_fact: - force_upgrade_raw: "no" - # <<< END TEMPORARY >>> - name: Normalize force-upgrade flag to boolean ansible.builtin.set_fact: @@ -903,17 +898,6 @@ - "force_upgrade={{ force_upgrade | default(false) }}" - "version_match={{ version_match | default(false) }}" - - name: Soft-block if already on target (skip staging/write unless force-upgrade) - when: - - not (force_upgrade | default(false) | bool) - - version_match | default(false) - ansible.builtin.set_fact: - _blocked: true - _journal: "{{ (_journal | default([])) + [ 'Device already running target image: ' ~ (banner_norm | default('')) ~ ' — skipping write/flip (use force-upgrade=yes to override)' ] }}" - expected_fw_core_early: "{{ expected_norm | default('') }}" - current_fw_core: "{{ banner_norm | default('') }}" - changed_when: false - - name: Back-fill compare names for summary (no-op if already set) when: not (_blocked | default(false)) ansible.builtin.set_fact: @@ -921,47 +905,6 @@ current_fw_core: "{{ current_fw_core | default(banner_norm | default('')) }}" changed_when: false - # ---------------------------- Normalize rebootin early (HOURS) ---------------------------- - - name: Normalize rebootin (strict hours → base seconds/minutes) - delegate_to: localhost - ansible.builtin.set_fact: - reboot_hours: "{{ (rebootin | default('') | string | trim | int) }}" - reboot_seconds: "{{ (rebootin | default('') | string | trim | int) * 3600 }}" - reboot_minutes: "{{ (rebootin | default('') | string | trim | int) * 60 }}" - reboot_requested: true - _reboot_requested: true - - - name: Compute reboot delay (+20s grace) and mirror underscore vars - delegate_to: localhost - ansible.builtin.set_fact: - reboot_delay_seconds: "{{ (reboot_seconds | int) + 20 }}" - reboot_delay_minutes: "{{ (((reboot_seconds | int) + 20) // 60) | int }}" - _reboot_seconds: "{{ (reboot_seconds | int) + 20 }}" - _reboot_minutes: "{{ (((reboot_seconds | int) + 20) // 60) | int }}" - - - name: Debug reboot normalization detail - delegate_to: localhost - ansible.builtin.debug: - msg: - - "rebootin={{ rebootin | default('UNSET') }}" - - "reboot_hours={{ reboot_hours }}" - - "reboot_seconds={{ reboot_seconds }}" - - "reboot_minutes={{ reboot_minutes }}" - - - 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=." - - - name: Debug reboot plan summary - delegate_to: localhost - ansible.builtin.debug: - msg: - - "reboot_requested={{ _reboot_requested | default(false) }}" - - "reboot_seconds={{ _reboot_seconds | default(0) }}" - - "reboot_minutes={{ _reboot_minutes | default(0) }}" - - name: Check local presence of image file on controller delegate_to: localhost ansible.builtin.stat: @@ -1151,7 +1094,7 @@ msg: "{{ (dev2_update_check.stdout | default('')) | trim }}" - name: Soft-block if 'update -c' did not return 'valid' - when: dev2_update_check is defined and not ((dev2_update_check.stdout | default('') | lower) is search('valid')) + when: dev2_update_check is defined and not (_blocked | default(false)) and not ((dev2_update_check.stdout | default('') | lower) is search('valid')) ansible.builtin.set_fact: _prep_blocked: true _blocked: true @@ -1414,7 +1357,7 @@ - "local_md5={{ (local_md5.stdout | default('NA')) | trim }}" - "dev2_md5_before={{ (dev2_md5_before.stdout | default('NA')) | trim }}" - "dev2_md5_after={{ (dev2_md5_after.stdout | default('NA')) | trim }}" - - "update_c_len={{ (dev2_update_check.stdout | default('') ) | length }}" + - "update_c_len={{ (dev2_update_check.stdout | default('') ) | length if (dev2_update_check is defined) else 'NA' }}" - "write_done={{ (dev2_up_write.stdout | default('')) is search('update is complete') if (dev2_up_write is defined) else 'NA' }}" - "backup_marker={{ _marker_specific | default('') }}" - "backup_marker_created={{ _backup_marker_created | default(false) }}" @@ -1458,6 +1401,16 @@ changed_when: true ignore_errors: true + - name: Debug backup marker cleanup result + when: (_backup_marker_created | default(false)) and not (_backup_prepare_success | default(false)) + delegate_to: localhost + ansible.builtin.debug: + msg: + - "backup_marker_cleanup_attempted=True" + - "backup_marker={{ _marker_specific | default('') }}" + changed_when: false + + - name: Remove temporary IP on DEV1 (tolerate 'Cannot assign requested address' and 'Address not available') when: dev2_conn_method | default('') == "tunnel" ansible.builtin.raw: >