--- - when: ubuntu_installer_version is undefined include_tasks: determine-latest-version.yml - name: compute target directory set_fact: ubuntu_installer_target_dir: "{{ installer_base_path }}/{{ ubuntu_installer_codename }}/{{ ubuntu_installer_version }}-{{ ubuntu_installer_variant }}" - name: prepare directories for installer files file: name: "{{ ubuntu_installer_target_dir }}" state: directory - name: find download location for release version import_tasks: find-location.yml - name: verfiy signature of SHA256SUMS file command: >- gpgv --keyring "{{ installer_keyrings_path | default(installer_base_path+'/keyrings') }}/ubuntu-cdimage.gpg" "{{ ubuntu_installer_target_dir }}/SHA256SUMS.gpg" "{{ ubuntu_installer_target_dir }}/SHA256SUMS" changed_when: False register: ubuntu_installer_gpg_result - debug: var: ubuntu_installer_gpg_result.stderr_lines - name: download and verify installer files block: - name: extract file hash from SHA256SUMS command: grep -E '^[0-9a-z]{64}\s+\*ubuntu-{{ ubuntu_installer_version | default("[0-9.]+") }}-{{ ubuntu_installer_variant }}-{{ ubuntu_installer_arch }}.iso$' "{{ ubuntu_installer_target_dir }}/SHA256SUMS" changed_when: false register: ubuntu_installer_sha256sum - name: extract filename from SHA256SUM set_fact: ubuntu_installer_filename: "{{ (ubuntu_installer_sha256sum.stdout.split(' ') | last)[1:] }}" - debug: msg: "will be downloading: {{ ubuntu_installer_base_url }}/{{ ubuntu_installer_filename }} (this will probably take a while...)" - name: download/verify installer file get_url: url: "{{ ubuntu_installer_base_url }}/{{ ubuntu_installer_filename }}" dest: "{{ ubuntu_installer_target_dir }}/{{ ubuntu_installer_filename }}" checksum: "sha256:{{ ubuntu_installer_sha256sum.stdout.split(' ') | first }}" force: "{{ ubuntu_installer_force_download }}" rescue: - fail: msg: "download/verification of installer files failed. Is the cd-image variant '{{ ubuntu_installer_variant }}' available for {{ ubuntu_installer_codename }}?"