Files
ansible/updateLinux.yml
T
2026-06-18 23:18:11 +03:00

21 lines
456 B
YAML

- name: Update all system packages
hosts: all
become: yes
tasks:
- name: Update packages to the latest version
dnf: name="*" state=latest
- name: Check if a reboot is required
command:
cmd: needs-restarting -r
register: reboot_check
changed_when: false
failed_when: reboot_check.rc not in [0, 1]
- name: Reboot the server only if needed
reboot:
when: reboot_check.rc == 1