Skip to content

Instantly share code, notes, and snippets.

@haslersn
Created April 2, 2019 15:32
Show Gist options
  • Save haslersn/4a63f32f7b0a88f41d5c7ca80da83d83 to your computer and use it in GitHub Desktop.
Save haslersn/4a63f32f7b0a88f41d5c7ca80da83d83 to your computer and use it in GitHub Desktop.
Firmware upgrades
diff --git a/tasks/upgrade_debian.yml b/tasks/upgrade_debian.yml
index fb81f3f..9a3e9cd 100644
--- a/tasks/upgrade_debian.yml
+++ b/tasks/upgrade_debian.yml
@@ -24,10 +24,44 @@
debug: msg="{{ updates.stdout_lines | count }} packages to upgrade ({{ updates.stdout_lines | join(', ') }})"
when: updates.stdout_lines | count > 1
+- name: Create mirrored /boot
+ file:
+ path: /tmp/boot
+ state: directory
+ when: upgrade_mirror_boot and updates.stdout_lines | count > 1
+
+- name: Synchronize mirrored /boot
+ synchronize:
+ src: /boot
+ dest: /tmp/boot
+ when: upgrade_mirror_boot and updates.stdout_lines | count > 1
+
+- name: Unmount /boot in order to mount its mirror
+ command: umount /boot
+ when: upgrade_mirror_boot and updates.stdout_lines | count > 1
+
+- name: Mount mirrored /boot
+ command: mount --bind /tmp/boot /boot
+ when: upgrade_mirror_boot and updates.stdout_lines | count > 1
+
- name: Upgrade packages
apt:
upgrade: safe
+- name: Unmount mirrored /boot
+ command: umount /boot
+ when: upgrade_mirror_boot and updates.stdout_lines | count > 1
+
+- name: Reload /etc/fstab
+ command: mount -a
+ when: upgrade_mirror_boot and updates.stdout_lines | count > 1
+
+- name: Synchronize /boot
+ synchronize:
+ src: /tmp/boot
+ dest: /boot
+ when: upgrade_mirror_boot and updates.stdout_lines | count > 1
+
- name: Check what the new version is
shell: lsb_release -r | awk '{print $2}'
changed_when: False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment