From 5c6dd30f5a73b7f0b32216cb6fe9b673c4fef0be Mon Sep 17 00:00:00 2001 From: pavel Date: Tue, 18 Nov 2025 11:42:21 +0200 Subject: [PATCH] 1142 --- files/ansible-playbooks/update-indoor3.yml | 49 +++------------------- 1 file changed, 6 insertions(+), 43 deletions(-) diff --git a/files/ansible-playbooks/update-indoor3.yml b/files/ansible-playbooks/update-indoor3.yml index cbf17f8..6e20324 100644 --- a/files/ansible-playbooks/update-indoor3.yml +++ b/files/ansible-playbooks/update-indoor3.yml @@ -29,14 +29,12 @@ ssh_opts_common: "-o PreferredAuthentications=password -o PubkeyAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NumberOfPasswordPrompts=1 -o ConnectTimeout=30" # Image to stage on DEV2 (we validate first; the actual write happens later) - image_filename: "2.2.1-r6801.bin" + image_filename: "fox200-2.2.1-r6801.bin" image_md5: "56b7211709de617e058b98d4204e2562" # Optional SHA256; leave empty to skip SHA256 checks image_sha256: "" dev2_image_dir: "/tmp" dev2_image_path: "{{ dev2_image_dir }}/{{ image_filename }}" - # Image URL for legacy (1.x) DEV2 that can't scp (downloaded directly from the internet on DEV2) - image_url: "https://cloud.ikeja.co.za/firmwares/fox200/{{ image_filename }}" # Reboot delay in HOURS (integer). Consumer always passes hours; 0 means immediate (~20s grace). rebootin: "" @@ -440,6 +438,7 @@ changed_when: false failed_when: false + - name: Debug listeners on picked port (after starting tunnel) when: dev2_conn_method == "tunnel" delegate_to: localhost @@ -1122,7 +1121,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \ @@ -1149,7 +1147,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=30 \ @@ -1160,19 +1157,15 @@ register: dev2_md5_before changed_when: false - # === HERE: split copy logic based on firmware major (scp for non-1.x, curl for 1.x) === - - name: Copy image to DEV2 with scp if missing or md5 mismatch (non-legacy firmware) - when: local_img.stat.exists - and dev2_passfile_used != "NONE" - and not (_blocked | default(false)) - and ((dev2_md5_before.stdout | trim) != image_md5) - and not ((banner_raw | default('') | trim).startswith('1.')) + - name: Copy image to DEV2 if missing or md5 mismatch + when: local_img.stat.exists and dev2_passfile_used != "NONE" and not (_blocked | default(false)) and ((dev2_md5_before.stdout | trim) != image_md5) delegate_to: localhost ansible.builtin.shell: | set -e HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" scp \ + -O \ -P "$PORT" \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ "{{ image_filename }}" "{{ dev2_ssh_user }}@${HOST}:{{ dev2_ssh_user == 'root' | ternary('/', '') }}{{ dev2_image_dir }}/" @@ -1181,28 +1174,6 @@ register: scp_push changed_when: true - - name: Copy image to DEV2 with curl if missing or md5 mismatch (legacy 1.x firmware) - when: local_img.stat.exists - and dev2_passfile_used != "NONE" - and not (_blocked | default(false)) - and ((dev2_md5_before.stdout | trim) != image_md5) - and ((banner_raw | default('') | trim).startswith('1.')) - delegate_to: localhost - ansible.builtin.shell: | - set -e - HOST="{{ dev2_ssh_host }}" - PORT="{{ dev2_ssh_port }}" - sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ - -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ - -o ConnectTimeout=30 \ - -p "$PORT" "{{ dev2_ssh_user }}@${HOST}" \ - "curl -L --fail --silent --show-error -k -o {{ dev2_image_path }} {{ image_url }}" - args: - executable: /bin/bash - register: scp_push - changed_when: true - # === END copy split === - name: Compute md5 of image on DEV2 after copy (or if already present) when: local_img.stat.exists and dev2_passfile_used != "NONE" and not (_blocked | default(false)) @@ -1212,7 +1183,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=30 \ @@ -1239,7 +1209,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \ @@ -1270,7 +1239,7 @@ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=30 \ - -p "$PORT" "{{ dev2_ssh_user }}@${HOST }}" \ + -p "$PORT" "{{ dev2_ssh_user }}@${HOST}" \ "update -c '{{ dev2_image_path }}' 2>&1 || true" args: executable: /bin/bash @@ -1410,7 +1379,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \ @@ -1439,7 +1407,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \ @@ -1464,7 +1431,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \ @@ -1483,7 +1449,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \ @@ -1503,7 +1468,6 @@ HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \ @@ -1526,7 +1490,6 @@ SECS="{{ _reboot_seconds | int }}" CMD='/sbin/reboot -d '"${SECS}"' >/dev/null 2>&1 &' sshpass -f "{{ dev2_passfile_used }}" ssh \ - -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ -o ConnectTimeout=10 \