From 9df9e6c1eec9fa27764b4c583b6601136dc72d48 Mon Sep 17 00:00:00 2001 From: Zakaria Date: Fri, 9 Aug 2024 06:10:31 +0000 Subject: [PATCH] full commit --- update_machines.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/update_machines.yml b/update_machines.yml index 64fb48b..2b76f18 100644 --- a/update_machines.yml +++ b/update_machines.yml @@ -28,13 +28,19 @@ - name: Reboot the server if necessary (Debian/Ubuntu) reboot: reboot_timeout: 600 - when: needsRestartingDebian.stdout == "1" + when: ansible_facts['os_family'] == "Debian" and needsRestartingDebian.stdout == "1" - name: Update all servers (Fedora) dnf: name: "*" state: latest when: ansible_facts['os_family'] == "RedHat" + + - name: Make sure dnf-utils is installed + dnf: + name: dnf-utils + state: present + when: ansible_facts['os_family'] == "RedHat" - name: See if a reboot is needed (Fedora) shell: "needs-restarting -r > /dev/null; echo $?" @@ -50,5 +56,5 @@ - name: Reboot the server if necessary (Fedora) reboot: reboot_timeout: 600 - when: needsRestartingFedora.stdout == "1" + when: ansible_facts['os_family'] == "RedHat" and needsRestartingFedora.stdout == "1"