mirror of
https://codeberg.org/hyperreal/ansible-homelab
synced 2024-11-01 08:33:07 +01:00
25 lines
593 B
YAML
25 lines
593 B
YAML
---
|
|
- hosts: servers
|
|
gather_facts: true
|
|
become: true
|
|
|
|
tasks:
|
|
- name: Perform a dist-upgrade
|
|
ansible.builtin.apt:
|
|
upgrade: dist
|
|
update_cache: true
|
|
|
|
- name: Check if reboot is required
|
|
ansible.builtin.stat:
|
|
path: /var/run/reboot-required
|
|
get_checksum: false
|
|
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: true
|