2024-08-01 08:06:57 +02:00
|
|
|
---
|
2024-10-26 20:35:07 +02:00
|
|
|
- hosts: servers
|
2024-08-01 08:06:57 +02:00
|
|
|
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
|