-
Notifications
You must be signed in to change notification settings - Fork 0
/
bios_update.yml
45 lines (39 loc) · 2.02 KB
/
bios_update.yml
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
---
# tasks/bios_update.yml for firmware_pcengines_apu
- name: Download new firmware
get_url:
url: "http://pcengines.ch/file/{{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout}}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom.tar.gz"
dest: "/tmp/{{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout }}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom.tar.gz"
- name: Extract new firmware
unarchive:
src: "/tmp/{{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout }}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom.tar.gz"
dest: /tmp
remote_src: yes
- name: Verify firmware binary file
command: md5sum -c {{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout }}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom.md5
args:
chdir: /tmp
register: wtd_firmware_pcengines_apu_md5check_cmd_result
changed_when: wtd_firmware_pcengines_apu_md5check_cmd_result.rc != 0
failed_when: wtd_firmware_pcengines_apu_md5check_cmd_result.rc != 0
- name: Flash new firmware
command: "flashrom -w {{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout }}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom -p internal"
args:
chdir: /tmp
register: wtd_firmware_pcengines_apu_flash_cmd_result
failed_when: wtd_firmware_pcengines_apu_flash_cmd_result.rc != 0
become: yes
when: wtd_firmware_pcengines_apu_md5check_cmd_result.rc == 0
- name: Remove downloaded files
file:
path: "/tmp/{{ item }}"
state: absent
loop:
- "{{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout }}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom.tar.gz"
- "{{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout }}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom.md5"
- "{{ wtd_firmware_pcengines_apu_system_product_name_cmd_result.stdout }}_{{ wtd_firmware_pcengines_apu_bios_version }}.rom"
- name: Activate reboot handler
command: "true"
notify:
- Reboot Machine
when: wtd_pcengines_apu_firmware_autoreboot