2021-06-10 14:41:21 +02:00
|
|
|
---
|
|
|
|
- name: Linux Package Upgrade
|
|
|
|
hosts: all
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
2021-06-10 17:10:58 +02:00
|
|
|
- name: "[Debian] Refresh Package Cache if not older that 1h"
|
2021-06-10 14:41:21 +02:00
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
cache_valid_time: 3600
|
|
|
|
become: true
|
2021-06-10 17:10:58 +02:00
|
|
|
when: ansible_os_family == "Debian"
|
2021-06-10 14:41:21 +02:00
|
|
|
|
2021-06-10 17:10:58 +02:00
|
|
|
- name: "[AlmaLinux] Refresh Package Cache if not older that 1h"
|
|
|
|
dnf:
|
|
|
|
update_cache: yes
|
|
|
|
become: true
|
|
|
|
when: ansible_os_family == "AlmaLinux"
|
|
|
|
|
|
|
|
- name: "[Debian] Remove Packages that can no longer be downloaded"
|
2021-06-10 14:41:21 +02:00
|
|
|
apt:
|
|
|
|
autoclean: yes
|
|
|
|
become: true
|
2021-06-10 17:10:58 +02:00
|
|
|
when: ansible_os_family == "Debian"
|
2021-06-10 14:41:21 +02:00
|
|
|
|
2021-06-10 17:10:58 +02:00
|
|
|
- name: "[Debian] Remove packages that are no longer required"
|
2021-06-10 14:41:21 +02:00
|
|
|
apt:
|
|
|
|
autoremove: yes
|
|
|
|
become: true
|
2021-06-10 17:10:58 +02:00
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
|
|
|
- name: "[AlmaLinux] Remove packages that are no longer required"
|
|
|
|
dnf:
|
|
|
|
autoremove: yes
|
|
|
|
become: true
|
|
|
|
when: ansible_os_family == "AlmaLinux"
|
2021-06-10 14:41:21 +02:00
|
|
|
|
2021-06-10 17:10:58 +02:00
|
|
|
- name: "[Debian] Upgrade all packages that need an update"
|
2021-06-10 14:41:21 +02:00
|
|
|
apt:
|
|
|
|
upgrade: full
|
|
|
|
become: true
|
2021-06-10 17:10:58 +02:00
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
|
|
|
- name: "[AlmaLinux] Upgrade all packages that need an update"
|
|
|
|
dnf:
|
|
|
|
name: "*"
|
|
|
|
state: latest
|
|
|
|
become: true
|
|
|
|
when: ansible_os_family == "AlmaLinux"
|
2021-06-10 14:41:21 +02:00
|
|
|
...
|
|
|
|
|