Ansible Pilot

Rolling Update RedHat like systems - Ansible module yum

Maintaining in a consistent state your fleet of machines is one of the most time-consuming tasks of the System Administrator. I'm going to show you how to perform Rolling Update with Ansible in RedHat-like systems with some simple code: RedHat Enterprise Linux, CentOS, CentOS Stream, Fedora, ClearOS, Oracle Linux, EuroLinux, Fermi Linux, EulerOS, ROSA Linux, Springdale Linux, Asianux

August 13, 2021
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

How to perform the rolling updates with Ansible in RedHat-like systems?

I’m going to show you a live demo with some simple Ansible code. I’m Luca Berton and welcome to today’s episode of Ansible Pilot

Ansible rolling update packages in RedHat-like systems

Today we’re talking about rolling updates in RedHat-like systems using Ansible module yum and DNF. We already talked about these modules for installing packages but we would like to consider another use case. Both manage packages with the yum/DNF package manager.

Parameters

The parameter list is pretty wide but today we are focus on these four options for our use case.

In the name could be a package or we could select all the packages of the system with the “*” star symbol.

The state for this case needs to be “latest” so we target the latest version for every package.

The “update_cache” is useful to forces the update of repository metadata before the installation, default no.

Other very interesting options are “bugfix” and “security” which allow you to update only packages marked as bugfix or security-related

Demo

Let’s jump in a real-life demo to rolling update in RedHat-like systems with Ansible Playbook.

---
- name: rolling update demo
  hosts: all
  become: true
  tasks:
    - name: ensure pkg updated
      ansible.builtin.yum:
        name: nginx
        state: latest
        update_cache: true
---
- name: rolling update demo
  hosts: all
  become: true
  tasks:
    - name: ensure system updated
      ansible.builtin.yum:
        name: "*"
        state: latest
        update_cache: true

code with ❤️ in GitHub

Recap

Now you know how to perform Rolling Update in RedHat-like systems. Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Follow me

Subscribe not to miss any new releases