From 9f0e2a07848cd1e315af997fa62a2b2c176b7ea5 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 29 Jun 2021 15:00:08 +0200 Subject: add ubuntu insaller fetch and base --- .../installer/ubuntu/fetch/tasks/fetch-version.yml | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 roles/installer/ubuntu/fetch/tasks/fetch-version.yml (limited to 'roles/installer/ubuntu/fetch/tasks/fetch-version.yml') diff --git a/roles/installer/ubuntu/fetch/tasks/fetch-version.yml b/roles/installer/ubuntu/fetch/tasks/fetch-version.yml new file mode 100644 index 00000000..868adc95 --- /dev/null +++ b/roles/installer/ubuntu/fetch/tasks/fetch-version.yml @@ -0,0 +1,41 @@ +--- +## 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_version }}/{{ 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_version }}" + +- 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_version }}/{{ 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_version }}" -- cgit v1.2.3