diff --git a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2019/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2019/tasks/main.yml index f5faa3e888..11c4f1502d 100644 --- a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2019/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2019/tasks/main.yml @@ -25,6 +25,22 @@ register: vs2019_layout_ready tags: adoptopenjdk +- name: Get SHA256 checksum of the file + win_shell: | + $filePath = "C:\TEMP\VS2019_Layout.zip" + $expectedChecksum = "C73A5F3C8A8AB50BC971551FA626438FEA89E0ED71F77EE570094E0C394C419E" + $actualChecksum = Get-FileHash -Path $filePath -Algorithm SHA256 | Select-Object -ExpandProperty Hash + + if ($actualChecksum -ne $expectedChecksum) { + Write-Output "Checksum mismatch" + Write-Output "Actual Checksum: $actualChecksum" + Write-Output "Expect Checksum: $expectedChecksum" + exit 1 + } + register: checksum_result + changed_when: false + tags: adoptopenjdk + # Exit Play If No VS2019 Layout & AdoptOpenJDK = true # This Is Defined Behaviour - This Shouldnt Occur But If It Does, Its Captured Here - name: Exit With Error When No Layout Within AdoptOpenJDK @@ -49,12 +65,17 @@ when: (vs2019_layout_ready.stat.exists) and (not vs2019_installed.stat.exists) tags: adoptopenjdk -- name: Remove Visual Studio 2019 Layout Files +- name: Remove VS2019 Zip File win_file: - path: "{{ items }}" - with_items: - - 'C:\TEMP\VS2019_Layout.zip' - - 'C:\temp\VSLayout2019' + path: C:\TEMP\VS2019_Layout.zip + state: absent + when: (not vs2019_installed.stat.exists) + tags: adoptopenjdk + +- name: Remove VS2019 Unzipped Layout + win_file: + path: C:\temp\VSLayout2019 + state: absent when: (not vs2019_installed.stat.exists) tags: adoptopenjdk