1 health
Luca Matteo Spoljarevic edited this page 2026-02-27 21:40:24 +01:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

health

Playbook to upgrade all packages on RHEL-based (DNF) hosts. Useful for keeping systems updated across the inventory.


dnfupdate.yml

  • Targets all hosts in the inventory.
  • Runs with become (root/sudo).
  • Uses the dnf module to:
    • Update the cache (update_cache: yes).
    • Set all installed packages to latest (name: "*", state: latest).

Use case: Batch security and updates on RHEL, Fedora, Rocky, Alma, etc.


How to run

ansible-playbook -i inventory.ini health/dnfupdate.yml -K

Restrict hosts with --limit if you dont want to update everything:

ansible-playbook -i inventory.ini health/dnfupdate.yml -K --limit "group_or_host"

Note: Only suitable for DNF/YUM-based systems. For APT or Pacman, use or add separate playbooks.