diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-06-29 15:00:08 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-06-29 15:00:08 +0200 |
commit | 9f0e2a07848cd1e315af997fa62a2b2c176b7ea5 (patch) | |
tree | be317237ee28d864dbec16203695c3b88544bbc5 /roles/installer/ubuntu/fetch/tasks/main.yml | |
parent | ch-equinox-* install ddrecsue (diff) |
add ubuntu insaller fetch and base
Diffstat (limited to 'roles/installer/ubuntu/fetch/tasks/main.yml')
-rw-r--r-- | roles/installer/ubuntu/fetch/tasks/main.yml | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/roles/installer/ubuntu/fetch/tasks/main.yml b/roles/installer/ubuntu/fetch/tasks/main.yml new file mode 100644 index 00000000..618cfd22 --- /dev/null +++ b/roles/installer/ubuntu/fetch/tasks/main.yml @@ -0,0 +1,43 @@ +--- +- name: prepare directories for installer files + file: + name: "{{ ubuntu_installer_target_dir }}" + state: directory + +- include_tasks: "fetch-{{ (ubuntu_installer_version is defined) | ternary('version', 'latest') }}.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 }}?" |