From e19d4210d319447c34462341898c26770f209bff Mon Sep 17 00:00:00 2001 From: pavel Date: Mon, 17 Nov 2025 17:13:43 +0200 Subject: [PATCH] 1713 --- .../update-indoor-bootenv.yml | 15 +++++++++++---- files/ansible-playbooks/update-indoor2.yml | 19 ++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/files/ansible-playbooks/update-indoor-bootenv.yml b/files/ansible-playbooks/update-indoor-bootenv.yml index 492561c..781d24a 100644 --- a/files/ansible-playbooks/update-indoor-bootenv.yml +++ b/files/ansible-playbooks/update-indoor-bootenv.yml @@ -1031,21 +1031,28 @@ ansible.builtin.raw: arping -U -I eth0 192.168.1.11 -c 3 - name: Copy bootenv image to DEV2 if missing or sha256 mismatch - when: local_img.stat.exists and dev2_passfile_used != "NONE" and not (_blocked | default(false)) and ((dev2_sha256_before.stdout | trim) != (bootenv_sha256 | trim)) + when: local_img.stat.exists + and dev2_passfile_used != "NONE" + and not (_blocked | default(false)) + and ((dev2_sha256_before.stdout | trim) != (bootenv_sha256 | trim)) delegate_to: localhost ansible.builtin.shell: | set -e HOST="{{ dev2_ssh_host }}" PORT="{{ dev2_ssh_port }}" - sshpass -f "{{ dev2_passfile_used }}" scp \ - -P "$PORT" \ + sshpass -f "{{ dev2_passfile_used }}" ssh \ + -o AddressFamily=inet \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ - "{{ bootenv_filename }}" "{{ dev2_ssh_user }}@${HOST}:{{ dev2_ssh_user == 'root' | ternary('/', '') }}{{ dev2_image_dir }}/" + -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ + -o ConnectTimeout=30 \ + -p "$PORT" "{{ dev2_ssh_user }}@${HOST}" \ + "wget -O '{{ dev2_image_path }}' 'https://cloud.ikeja.co.za/firmwares/uboot/{{ bootenv_filename }}'" args: executable: /bin/bash register: scp_bootenv changed_when: true + - name: Compute sha256 of bootenv image on DEV2 after copy (or if already present) when: local_img.stat.exists and dev2_passfile_used != "NONE" and not (_blocked | default(false)) delegate_to: localhost diff --git a/files/ansible-playbooks/update-indoor2.yml b/files/ansible-playbooks/update-indoor2.yml index 93bd586..9657f95 100644 --- a/files/ansible-playbooks/update-indoor2.yml +++ b/files/ansible-playbooks/update-indoor2.yml @@ -1157,29 +1157,22 @@ register: dev2_md5_before changed_when: false - - name: Copy bootenv image to DEV2 if missing or sha256 mismatch - when: local_img.stat.exists - and dev2_passfile_used != "NONE" - and not (_blocked | default(false)) - and ((dev2_sha256_before.stdout | trim) != (bootenv_sha256 | trim)) + - 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 }}" ssh \ - -o AddressFamily=inet \ + sshpass -f "{{ dev2_passfile_used }}" scp \ + -P "$PORT" \ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ - -o PreferredAuthentications=password -o NumberOfPasswordPrompts=1 \ - -o ConnectTimeout=30 \ - -p "$PORT" "{{ dev2_ssh_user }}@${HOST}" \ - "wget -O '{{ dev2_image_path }}' 'https://cloud.ikeja.co.za/firmwares/uboot/{{ bootenv_filename }}'" + "{{ image_filename }}" "{{ dev2_ssh_user }}@${HOST}:{{ dev2_ssh_user == 'root' | ternary('/', '') }}{{ dev2_image_dir }}/" args: executable: /bin/bash - register: scp_bootenv + register: scp_push changed_when: true - - 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)) delegate_to: localhost