Files
ansible-config/playbooks/infrastructure/01-system-update.yml

32 lines
720 B
YAML
Raw Permalink Normal View History

---
- name: System update and cleanup
hosts: all_except_ansible
become: yes
tasks:
- name: Stop unattended upgrades
systemd:
name: unattended-upgrades
state: stopped
- name: Clean any apt locks
shell: |
pkill -9 apt-get apt dpkg 2>/dev/null || true
rm -f /var/lib/apt/lists/lock /var/lib/dpkg/lock*
dpkg --configure -a 2>/dev/null || true
ignore_errors: yes
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 86400
- name: Upgrade system packages
apt:
upgrade: safe
autoremove: yes
- name: Clean apt cache
apt:
autoclean: yes