Ansible >=2.17 does not support Python <= 3.6: see issue
This is relevant for EL8 distros:redhat-8, almalinux-8, rockylinux-8 or similar
Does it make sense to drop compatibility with EL8?
Older versions of Ansible (ansible-core <= 2.16) are already EOL.
Besides the "what is the best approach" question, for this role, the main dependency is python3-dnf, which relies on python3.6 for EL8, and there is no pip alternative for the package. The community has created a placeholder for it, but there is no package available at the moment
A possible workaround is to install packages using ansible.builtin.command: dnf install ... instead of ansible.builtin.package which uses ansible.builtin.dnf and is the one that has the dependency with python3-dnf