Red Hat Ansible
I already know and have explained how easy it is to make an Ansible task run only on a specific Linux distro family (Debian/Ubuntu or RedHat/Centos), but recently needed to go even further: limit certain Ansible tasks to be run on specific RHEL releases.
First, let me remind you how to specify that a task should be run for a certain distro family and not the others:
In this example, the first task (Disable IPv6) will only deploy the sysctl config element on RedHat (CentOS, Fedora) systems.
The second task will only run on Debian/Ubuntu family of Operating Systems.
Now to the issue at hand: while IPv6 was possible to disable in RHEL 6 and RHEL 7, it seems the IPv6 module is built-in with RHEL 8/CentOS 8 distros – and so there’s no point in trying to disable it.
Here’s how I created a task that would only run on RedHat/CentOS releases older than RHEL 8/CentOS 8:
That’s it for today!