create a meta file to execute sub roles. Remove / add blank lines at the end. Add mock

This commit is contained in:
Lukas Greve
2025-11-22 11:22:46 +01:00
parent 3553a8d289
commit 205f7b83be
5 changed files with 12 additions and 1 deletions

25
roles/update.yml Normal file
View File

@@ -0,0 +1,25 @@
---
- name: Update system packages
hosts: gitrunner
become: true
tasks:
- name: Update system packages
ansible.builtin.dnf:
name: "*"
state: latest
update_cache: true
- name: Check if reboot required (RedHat/CentOS)
ansible.builtin.command: needs-restarting -r
register: needs_restarting_output
changed_when: false
ignore_errors: true
when: ansible_os_family == "RedHat"
- name: Reboot if required (RedHat/CentOS)
ansible.builtin.reboot:
when:
- ansible_os_family == "RedHat"
- needs_restarting_output.rc == 1
- needs_restarting_output is defined