feat: add YUM package management tasks for updates and reboots in yum_updates.yaml
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
- hosts: yumhosts
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Update all installed packages using YUM module
|
||||
ansible.builtin.yum:
|
||||
use_backend: yum3
|
||||
name: '*'
|
||||
state: latest
|
||||
update_cache: yes
|
||||
update_only: yes
|
||||
register: yum_update_status
|
||||
|
||||
- name: Remove packages not needed anymore
|
||||
ansible.builtin.yum:
|
||||
use_backend: yum3
|
||||
autoremove: yes
|
||||
|
||||
- name: Check if a file exists
|
||||
ansible.builtin.stat:
|
||||
path: /var/run/needs-restarting
|
||||
register: reboot_required_file
|
||||
|
||||
- name: Reboot if required
|
||||
ansible.builtin.reboot:
|
||||
reboot_timeout: 120 # Adjust timeout as needed
|
||||
when: reboot_required_file.stat.exists
|
||||
Reference in New Issue
Block a user