From 4b84472ac29ee6c8010224529984672887f9b5b5 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Fri, 24 Nov 2023 12:13:38 +0100 Subject: [PATCH] Add role for ensuring system is updated and potentially rebooted The role also cleans up the local repository of retrieved package files that can no longer be downloaded. --- playbooks/roles/system_update/handlers/main.yaml | 5 +++++ playbooks/roles/system_update/tasks/main.yaml | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 playbooks/roles/system_update/handlers/main.yaml create mode 100644 playbooks/roles/system_update/tasks/main.yaml diff --git a/playbooks/roles/system_update/handlers/main.yaml b/playbooks/roles/system_update/handlers/main.yaml new file mode 100644 index 0000000..38e5810 --- /dev/null +++ b/playbooks/roles/system_update/handlers/main.yaml @@ -0,0 +1,5 @@ +# Reboot to apply potentially outstanding kernel updates and make sure all the +# latest versions of libraries are used. +- name: Reboot, if stuff changed, for good measure + ansible.builtin.reboot: + become: true diff --git a/playbooks/roles/system_update/tasks/main.yaml b/playbooks/roles/system_update/tasks/main.yaml new file mode 100644 index 0000000..6e68538 --- /dev/null +++ b/playbooks/roles/system_update/tasks/main.yaml @@ -0,0 +1,7 @@ +- name: Ensure the system is updated and no longer needed files are cleaned up + ansible.builtin.apt: + update_cache: true + upgrade: dist + autoclean: true + become: true + notify: Reboot, if stuff changed, for good measure