dnf module error for python 3.8.6 version

Latest response

We have a Linux OS patching playbook written and working smoothly for RHEL 7/8 servers but recently built RHEL 8 servers are giving issue for which python default version is 3.8.3 and it's working very well with python version 3.6.8. It's very strange it's not working on python latest version but we are not positive on downgrading the version. As a workaround, we had used alternatives python to use 3.6.8 but we are looking for permanent solution. we are using ansible version 2.10.6 and controller node is RHEL 8 with latest kernel version which is released this month.

We have installed the package python-dnf package as well as dnf pip module is installed in both controller node and remote server but that didn't fix the issue. playbook works perfectly with python 3.6.8 version.

Sample output

 # python
Python 3.8.0 (default, Mar  9 2020, 18:02:46) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dnf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

# python
Python 3.6.8 (default, Dec  5 2019, 15:45:45) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dnf
>>> 

Responses