From 86447d24f09d3a801b48a99e0aa8cc6f50df061c Mon Sep 17 00:00:00 2001 From: James Turland Date: Sat, 16 Mar 2024 00:23:51 +0000 Subject: [PATCH] update --- Ansible/Playbooks/Update/update-builtin.yml | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Ansible/Playbooks/Update/update-builtin.yml diff --git a/Ansible/Playbooks/Update/update-builtin.yml b/Ansible/Playbooks/Update/update-builtin.yml new file mode 100644 index 0000000..0ae92d8 --- /dev/null +++ b/Ansible/Playbooks/Update/update-builtin.yml @@ -0,0 +1,24 @@ +--- +- hosts: all + gather_facts: yes + become: yes + + tasks: + - name: Perform a distro 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 necessary) + ansible.builtin.reboot: + when: reboot_required_file.stat.exists == true + + - name: Remove dependencies that are no longer needed + ansible.builtin.apt: + autoremove: yes \ No newline at end of file