Running Ansible playbooks against RHEL 8 servers

I’m experimenting with some Ansible playbooks against local VMs, in particular, for some reason a RHEL 8 VM, and getting some unitelligible errors:

File \"<frozen importlib._bootstrap_external>\", line 1112, in _legacy_get_spec\r\n  File \"<frozen importlib._bootstrap>\", line 441, in spec_from_loader\r\n  File \"<frozen importlib._bootstrap_external>\", line 544, in spec_from_file_location\r\n  File \"/tmp/ansible_ansible.legacy.setup_payload_z3bjr2pn/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py\", line 5\r\nSyntaxError: future feature annotations is not defined\r\n", "msg": "MODULE FAILURE: No start of json char found\nSee stdout/stderr for the exact error", "rc": 1}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}

Googling for various parts of this error, I think the key error is:

SyntaxError: future feature annotations is not defined

… as this shows up in a few posts, and in particular this excellent post by Jeff Geerling that explains exactly what is going on with Python version incompatibilities between later versions of Ansible and RHEL 8 (which uses an older version of Python, 3.7)

Ansible version on my Mac:

❯ ansible-playbook --version
ansible-playbook [core 2.18.6]

Downgrading to Ansible 9x with brew:

❯ brew install ansible@9
==> Fetching downloads for: ansible@9
Warning: ansible@9 has been deprecated because it is not maintained upstream! It will be disabled on 2025-11-30

For personal projects this is not much of a big deal, and I don’t think I’m particularly taking advantage of any newer Ansible features, but bit of a version dependency nightmare.

Now I get:

❯ ansible --version
ansible [core 2.16.14]

… and can successfully apply playbooks against my RHEL 8 VM.

RHEL 8 yum update gives 403 errors

Starting a RHEL 8 VM I haven’t started for a while I got the following errors trying a ‘yum update’ :

Updating Subscription Management repositories.

This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.

Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 78 B/s | 468 B 00:05
Errors during downloading metadata for repository 'rhel-8-for-x86_64-appstream-rpms':
- Status code: 403 for https://cdn.redhat.com/content/dist/rhel8/8/x86_64/appstream/os/repodata/repomd.xml (IP: 95.101.84.251)
Error: Failed to download metadata for repo 'rhel-8-for-x86_64-appstream-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

Piecing together multiple suggestions, e.g. from here, I needed to clear my last subscription registration and re-register:

sudo subscription-manager clean
sudo subscription-manager register --username [redhat account id]

After re-registering, ‘yum update’ now works as expected.

Installing kernel headers for Oracle Linux 6 on VirtualBox

The usual reason for Guest Additions failing to install on a Linux guest on Virtual Box is that the kernel headers are missing. How you install these or where they come from varies from distro to distro, although they’re usually available via the package manager on that distro.

I had an Oracle Linux 6 guest installed, Guest Additions (for video drivers, shared folder, clipboard sharing) was all working, and then at some point I started it up again and it was no longer working and wouldn’t re-install either. Seems like I’d picked up an update, and I needed to update the kernel headers too.

This post covers the steps needed. On OE6 before installing the Guest Additions, just run ‘yum install kernel-uek-devel’ and you should be good to go (assuming you’re booting with the ‘unbreakable kernel’ and not the RHEL compatible kernel)

Fedora 18 & 19 – terrible performance on Virtual Box

I’m not sure what the deal is with Fedora 18 & 19 but the performance running under Virtual Box in Windows, regardless of how much memory you throw at the VM, really is unbearably slow. I had 18 installed for a while but haven’t used it for several months. I just fired it up again and it’s unusable. Downloaded 19 and started the install and it took a couple of hours. I might have something else going on on my laptop that slowing down the performance, but as it is it’s unusable.

I was looking for a RHEL derivative other than Oracle Linux since I wasn’t prepared wait to download the massive disk images which are several GB (really?!). I just realized though that CentOS is RHEL compatible. Very cool. Will download and see if it’s more usable under Virtual Box.