Problem:
So we have a playbook that installs our AV, which includes doing some api calls, installing the GPG key and lastly install the AV. However it seems that using the uri and apt_key module’s no longer work and is throwing the following error:
An unknown error occurred: HTTPSConnection.__init__() got an unexpected keyword argument 'cert_file'
Our foreman host runs on RHEL 9 and is running ansible core: ansible-core-2.14.17-1.el9 from the official RedHat repo.
When looking into this, i noticed a newer ansible would fix this:
So ansible version 2.18 would fix that. But…
“However, starting with RHEL 9.3, we are not planning on releasing new versions of Ansible Core in RHEL 9. Instead, we are planning on supporting Ansible Core 2.14 for the remainder of the RHEL 9 lifecycle. Read on for more details.”
Source: Updates to using Ansible Core in Red Hat Enterprise Linux
Ubuntu 22.04 uses python 3.10 onwards, Ubuntu 24.04 uses Python 3.12 onwards. And the latter one introduces the change that causes this all.
The question:
I’m unsure how to properly tackle this issue now
- ansible-core package is needed for Foreman-Katello to use ansible so using the pip variant isn’t an option (or we would have a mixed setup of a pip ansible and the package version and have to redirect foreman to use the pip one). I assume this isn’t a supported/recommended setup.
- We could install an older version of python on all the newer ubuntu system’s and use that for ansible. But personally i feel like this is more of a last resort action to adjust all the customer environments so ansible works more fully again.
I’m also writing a support ticket to redhat about it, but this is something i noticed from a RHEL os, with foreman, using ansible 2.14 to an 24.04 Ubuntu host using Python 3.12. I don’t think foreman nor Ubuntu are relevant but i’m unsure if RedHat would take this case to maybe backport this bugfix to Ansible.
So my question to anyone reading this is, have you had to deal with this? And how did you resolve it? What would be the best approach to properly fix ansible with newer python versions?
Expected outcome:
Able to use modules like uri and apt_key again.
Foreman and Proxy versions:
3.13
Foreman and Proxy plugin versions:
3.13
Distribution and version:
RHEL 9
Other relevant data: