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.

rsync files to a Ugreen NAS

Ensure ‘Enable backup rsync service’ is enabled in your Ugreen Control Panel, and select an existing user that will be used when transferring with rsync:

To rsync a local folder to your Ugreen NAS, use:

rsync -avz ./local-folder/  user-enabled-for-rsync@your-ugreen-ip:NAME_OF_SHARE

Note that instead of using the path of a folder on a volume, e.g. /volume1/folder, if folder is the name of the share, use this as the target path without any absolete path prefix.

This is hinted at in this post, and while it seems to differ from how you’d normally specify a remote destination, this is how rsync on a Ugreen appears to work.