Automating RHEL Patch Management Using Chef

Patching Red Hat Enterprise Linux by hand does not survive a fleet. Chef can apply package updates in the same run that enforces the rest of the host, which is useful only if the reboot and the exception process are designed first.

Start from the life cycle, not the cookbook

RHEL 8, 9, and 10 are the releases most teams should be patching under a current subscription. RHEL 7 is different: maintenance support has ended, and further fixes depend on the extended contract the customer actually holds. A Chef resource cannot install an erratum Red Hat is no longer publishing to your account. Confirm the life-cycle phase before you encode a monthly update job.

What the cookbook should do

  • Update packages from the repositories your subscription already entitles, using yum on RHEL 7 and dnf on RHEL 8 and newer.
  • Keep a small exclude list for packages an application vendor has pinned, and review that list. An exclude that nobody remembers is how a host stays vulnerable.
  • Notify a reboot only when the update requires one. Kernel and glibc updates usually do. A library update often does not.
  • Reboot inside the maintenance window, in batches, and stop the batch if the first hosts do not return to the load balancer.

chef-client should run often enough to apply configuration, and the patch resources should be guarded so they do not update production in the middle of the day just because the client woke up. A window attribute, or a separate patch recipe that scheduled jobs include, is clearer than a cookbook that always calls a full update.

Prove it before the estate

Run the change on a non-production node that matches production closely enough to catch a bad dependency. Record the chef-client output. If the run is red, fix the cookbook. Do not SSH around it and leave the next node to fail the same way.

MMConsultancy builds this kind of Chef patch workflow inside the change process you already use. Tell us how you patch today if you want it taken out of a shell history.