From 690e7de4f2dd0962e6523afc0bd9bacd897e5698 Mon Sep 17 00:00:00 2001 From: Vincent Stuyck Date: Sat, 19 Jul 2025 23:29:32 +0200 Subject: [PATCH] add update debian playbook --- update-debian.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 update-debian.yaml diff --git a/update-debian.yaml b/update-debian.yaml new file mode 100644 index 0000000..3f325b0 --- /dev/null +++ b/update-debian.yaml @@ -0,0 +1,25 @@ +--- +# source: https://www.jeffgeerling.com/blog/2022/ansible-playbook-upgrade-ubuntudebian-servers-and-reboot-if-needed +- hosts: all + gather_facts: yes + become: yes + + tasks: + - name: Perform a dist-upgrade. + ansible.builtin.apt: + upgrade: dist + update_cache: yes + + - name: Check if a reboot is required. + ansible.builtin.stat: + path: /var/run/reboot-required + get_checksum: no + register: reboot_required_file + + - name: Reboot the server (if required). + ansible.builtin.reboot: + when: reboot_required_file.stat.exists == true + + - name: Remove dependencies that are no longer required. + ansible.builtin.apt: + autoremove: yes \ No newline at end of file