This commit is contained in:
Jack
2025-08-03 17:56:59 +01:00
commit 9792d05450
8 changed files with 105 additions and 0 deletions

29
update.yml Normal file
View File

@@ -0,0 +1,29 @@
---
- hosts: all
gather_facts: yes
become: yes
tasks:
- name: Update and upgrade apt packages
become: true
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
- name: Remove dependencies that are no longer required.
ansible.builtin.apt:
autoremove: yes
- name: Check if a reboot is required.
become: true
ansible.builtin.stat:
path: /var/run/reboot-required
get_checksum: no
register: reboot_required_file
- name: Reboot the server (if required).
become: true
tags: reboot
ansible.builtin.reboot:
when: reboot_required_file.stat.exists == true