diff --git a/files/ansible-playbooks/update-indoor2.yml b/files/ansible-playbooks/update-indoor2.yml index 9657f95..93bd586 100644 --- a/files/ansible-playbooks/update-indoor2.yml +++ b/files/ansible-playbooks/update-indoor2.yml @@ -1157,22 +1157,29 @@ register: dev2_md5_before changed_when: false - - 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) + - 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)) 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 \ - "{{ image_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_push + register: scp_bootenv 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