blob: 05d2ad6ea516a2f1a37eb31289f239cee39e9493 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
---
- name: Create download directory
file:
dest: "{{ openwrt_download_dir }}"
state: directory
- block:
- name: Generate OpenWrt download URLs
set_fact:
openwrt_url:
https://downloads.openwrt.org/releases/{{ openwrt_release }}/targets/{{ openwrt_arch | mandatory }}/{{ openwrt_target }}
- name: Download sha256sums
get_url:
url: "{{ openwrt_url }}/sha256sums"
dest: "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256"
- name: Download sha256sums.asc
get_url:
url: "{{ openwrt_url }}/sha256sums.asc"
dest: "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc"
- name: Check OpenPGP signature
command: >-
gpg --no-options --no-default-keyring --secret-keyring /dev/null
--verify --keyring "{{ role_path }}/openwrt-keyring.gpg"
--trust-model always
"{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc"
changed_when: False
- name: Extract SHA256 hash of the imagebuilder archive
command: grep '{{ openwrt_tarball_name }}' "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256"
register: sha256
changed_when: False
- name: Download imagebuilder
get_url:
url: "{{ openwrt_url }}/{{ openwrt_tarball_name }}"
dest: "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
checksum: sha256:{{ sha256.stdout.split(' ') | first }}
rescue:
- name: Delete downloaded artifacts
loop:
- "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256"
- "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc"
- "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
file:
path: "{{ item }}"
state: absent
- name: the download has failed...
fail:
msg: Something borked
|