--- ## we need to try old-releases.ubuntu.com first because otherwise it would be impossible to download the initial release ## of any codename release. (i.e. 20.04) - name: try downloading SHA256SUMS and signature file from old-releases.ubuntu.com loop: - SHA256SUMS - SHA256SUMS.gpg get_url: url: "https://old-releases.ubuntu.com/releases/{{ ubuntu_installer_codename }}/{{ item }}" dest: "{{ ubuntu_installer_target_dir }}/{{ item }}" force: yes register: ubuntu_installer_old failed_when: "'status_code' in ubuntu_installer_old and ubuntu_installer_old.status_code not in [200, 404]" - when: 404 not in (ubuntu_installer_old.results | selectattr('status_code', 'defined') | map(attribute='status_code') | list) block: - name: check if SHA256SUM actually contains the correct iso command: grep -E '^[0-9a-z]{64}\s+\*ubuntu-{{ ubuntu_installer_version }}-{{ ubuntu_installer_variant }}-{{ ubuntu_installer_arch }}.iso$' "{{ ubuntu_installer_target_dir }}/SHA256SUMS" changed_when: false failed_when: false register: ubuntu_installer_old_sha256sum - name: set download url to old-releases.ubuntu.com when: (ubuntu_installer_old_sha256sum.stdout_lines | length) > 0 set_fact: ubuntu_installer_base_url: "https://old-releases.ubuntu.com/releases/{{ ubuntu_installer_codename }}" - when: ubuntu_installer_base_url is not defined block: - name: try downloading SHA256SUMS and signature file from releases.ubuntu.com loop: - SHA256SUMS - SHA256SUMS.gpg get_url: url: "https://releases.ubuntu.com/{{ ubuntu_installer_codename }}/{{ item }}" dest: "{{ ubuntu_installer_target_dir }}/{{ item }}" force: yes - name: set download url to releases.ubuntu.com set_fact: ubuntu_installer_base_url: "https://releases.ubuntu.com/{{ ubuntu_installer_codename }}"