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"